/**
  * Helper method to Perform Reflection to Get Static Field of Provided Type. Field is assumed
  * Private.
  *
  * @param fieldName
  * @param type
  * @return
  */
 public static <T> T getFieldFromReflection(
     String fieldName, Class<?> containingClass, Class<T> type) {
   try {
     Field desiredField = containingClass.getDeclaredField(fieldName);
     desiredField.setAccessible(true);
     return type.cast(desiredField.get(null));
   } catch (NoSuchFieldException e) {
     JASLog.log()
         .severe(
             "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.",
             fieldName, type.getSimpleName());
     e.printStackTrace();
   } catch (IllegalArgumentException e) {
     JASLog.log()
         .severe(
             "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.",
             fieldName, type.getSimpleName());
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     JASLog.log()
         .severe(
             "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.",
             fieldName, type.getSimpleName());
     e.printStackTrace();
   } catch (SecurityException e) {
     JASLog.log()
         .severe(
             "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.",
             fieldName, type.getSimpleName());
     e.printStackTrace();
   }
   return null;
 }
Exemplo n.º 2
0
 public void SetAlertDialog(DialogInterface arg0, boolean show) {
   if (show) {
     try {
       Field mField = arg0.getClass().getSuperclass().getDeclaredField("mShowing");
       mField.setAccessible(true);
       mField.set(arg0, true);
     } catch (NoSuchFieldException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IllegalArgumentException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IllegalAccessException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   } else {
     try {
       Field mField = arg0.getClass().getSuperclass().getDeclaredField("mShowing");
       mField.setAccessible(true);
       mField.set(arg0, false);
     } catch (NoSuchFieldException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IllegalArgumentException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IllegalAccessException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }
Exemplo n.º 3
0
 static {
   try {
     itemDamageField = getPrivateField(ItemStack.class, "itemDamage", "field_77991_e", "e");
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 4
0
 /** @param concept */
 public void setConcept(URI concept) {
   if (validility) {
     try {
       Field field = EntityImpl.class.getDeclaredField("concept");
       if (concept != null) {
         Object newObj = new ClassURI(concept);
         writemapper.replaceObject(field.getAnnotation(winter.class), this, newObj);
       } else {
         writemapper.deleteObject(
             field.getAnnotation(winter.class),
             null,
             this,
             field.getAnnotation(winter.class).var(),
             false);
       }
     } catch (NoSuchFieldException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (SecurityException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   this.concept = new ClassURI(concept);
 }
Exemplo n.º 5
0
  @Override
  public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (fromUser) {
      // for  java.lang.ClassCastException
      Object tag = seekBar.getTag();
      int n;
      if (tag instanceof Integer) n = (Integer) tag;
      else if (tag instanceof String) n = Integer.parseInt((String) tag);
      else throw new IllegalArgumentException("wtf exception");

      TextView textView;
      try {
        textView =
            (TextView) this.getClass().getDeclaredField("text" + String.valueOf(n)).get(this);
        textView.setText(
            String.format("%.0f db", EqualizerBandsFragment.convertProgressToGain(progress)));
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (NoSuchFieldException e) {
        e.printStackTrace();
      }

      saveBound(progress, n);
      BassPlayer.updateFX(progress, n);
    }
  }
Exemplo n.º 6
0
  private static int getValueFor(String enumeration) {
    try {
      // Get last part and first part
      String[] stringItems = enumeration.split("\\.");
      String lastPart = stringItems[stringItems.length - 1];
      String firstPart = "";
      for (int a = 0; a < stringItems.length - 2; a++)
        firstPart = firstPart.concat(stringItems[a] + ".");
      firstPart = firstPart.concat(stringItems[stringItems.length - 2]);

      Class c = Class.forName(firstPart); // get the class
      try {
        Field enumerator = c.getField(lastPart); // get the field (lastPart) from the class
        try {
          return enumerator.getInt(c); // get the value of the field
        } catch (IllegalArgumentException e2) {

          e2.printStackTrace();
        } catch (IllegalAccessException e2) {

          e2.printStackTrace();
        }
      } catch (SecurityException e1) {

        e1.printStackTrace();
      } catch (NoSuchFieldException e1) {

        e1.printStackTrace();
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
    return 0;
  }
Exemplo n.º 7
0
  /**
   * 将父类对像转成子类的对象,不能有带参数构造方法 仅仅是将同名的字段值复制
   *
   * @param parent
   * @param childClass
   * @return
   */
  public static Object castToChild(Object parent, Class childClass) {
    //        if(parent instanceof type)
    //        {
    //            return parent;
    //        }

    Class parentClass = parent.getClass();
    if (parentClass == childClass) return parent;
    if (parentClass.isAssignableFrom(childClass)) {
      Field[] parentFields = parentClass.getDeclaredFields();
      try {
        Object child = childClass.newInstance();
        for (Field field : parentFields) {
          field.setAccessible(true);
          Field childField = childClass.getSuperclass().getDeclaredField(field.getName());
          childField.setAccessible(true);
          childField.set(child, field.get(parent));
        }
        return child;
      } catch (InstantiationException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (NoSuchFieldException e) {
        e.printStackTrace();
      }
    }
    return null;
  }
  public static int getResourseIdByName(String packageName, String className, String name) {
    Class r = null;
    int id = 0;
    try {
      r = Class.forName(packageName + ".R");

      Class[] classes = r.getClasses();
      Class desireClass = null;

      for (int i = 0; i < classes.length; i++) {
        if (classes[i].getName().split("\\$")[1].equals(className)) {
          desireClass = classes[i];

          break;
        }
      }

      if (desireClass != null) id = desireClass.getField(name).getInt(desireClass);
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (SecurityException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (NoSuchFieldException e) {
      e.printStackTrace();
    }

    return id;
  }
Exemplo n.º 9
0
  public void setInnerFocus(boolean bFocus) {
    mBMyFocus = bFocus;
    if (mBMyFocus) {
      requestFocus();
    } else {
      Field field;

      try {
        field = getClass().getSuperclass().getSuperclass().getDeclaredField("mPrivateFlags");
        field.setAccessible(true);

        field.set(this, new Integer(2));

        clearFocus();
      } catch (NoSuchFieldException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
Exemplo n.º 10
0
 public static Field getNmsField(Class clazz, String fieldName) {
   if (isForge) {
     try {
       return clazz.getField(ForgeFieldMappings.get(clazz.getName()).get(fieldName));
     } catch (NoSuchFieldException ex) {
       ex.printStackTrace();
     } catch (NullPointerException ignored) {
     }
   }
   try {
     return clazz.getField(fieldName);
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   }
   return null;
 }
 /**
  * 获取状态栏高度
  *
  * @param activity
  * @return
  */
 public int getStatusHeight(Activity activity) {
   int statusHeight = 0;
   Rect localRect = new Rect();
   activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(localRect);
   statusHeight = localRect.top;
   if (0 == statusHeight) {
     Class<?> localClass;
     try {
       localClass = Class.forName("com.android.internal.R$dimen");
       Object localObject = localClass.newInstance();
       int i5 =
           Integer.parseInt(localClass.getField("status_bar_height").get(localObject).toString());
       statusHeight = activity.getResources().getDimensionPixelSize(i5);
     } catch (ClassNotFoundException e) {
       e.printStackTrace();
     } catch (IllegalAccessException e) {
       e.printStackTrace();
     } catch (InstantiationException e) {
       e.printStackTrace();
     } catch (NumberFormatException e) {
       e.printStackTrace();
     } catch (IllegalArgumentException e) {
       e.printStackTrace();
     } catch (SecurityException e) {
       e.printStackTrace();
     } catch (NoSuchFieldException e) {
       e.printStackTrace();
     }
   }
   return statusHeight;
 }
Exemplo n.º 12
0
  private String getValue(QualifiedName name, ASTNode astNode, final JstType jstType) {

    TranslateInfo tInfo = TranslateCtx.ctx().getTranslateInfo(jstType);

    String typeName = name.getQualifier().getFullyQualifiedName();
    String fullName = tInfo.getImported(typeName);
    try {
      Class<?> toClass = Class.forName(fullName);
      Field field = toClass.getField(name.getName().toString());
      return (String) field.get(toClass);
    } catch (SecurityException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (NoSuchFieldException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return null;
  }
Exemplo n.º 13
0
  public static void removeGoalSelectors(org.bukkit.entity.Entity paramEntity) {
    try {
      if (_goalSelector == null) {
        _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector");
        _goalSelector.setAccessible(true);
      }
      if ((((CraftEntity) paramEntity).getHandle() instanceof EntityInsentient)) {
        EntityInsentient localEntityInsentient =
            (EntityInsentient) ((CraftEntity) paramEntity).getHandle();

        PathfinderGoalSelector localPathfinderGoalSelector =
            new PathfinderGoalSelector(
                ((CraftWorld) paramEntity.getWorld()).getHandle().methodProfiler);

        _goalSelector.set(localEntityInsentient, localPathfinderGoalSelector);
      }
    } catch (IllegalArgumentException localIllegalArgumentException) {
      localIllegalArgumentException.printStackTrace();
    } catch (IllegalAccessException localIllegalAccessException) {
      localIllegalAccessException.printStackTrace();
    } catch (NoSuchFieldException localNoSuchFieldException) {
      localNoSuchFieldException.printStackTrace();
    } catch (SecurityException localSecurityException) {
      localSecurityException.printStackTrace();
    }
  }
Exemplo n.º 14
0
  /** 实现放大缩小控件隐藏 */
  public static void setZoomControlGone(WebView view) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // 用于判断是否为Android 3.0系统, 然后隐藏缩放控件
      view.getSettings().setDisplayZoomControls(false);
    } else {

      // Android 3.0(11) 以下使用以下方法:
      // 利用java的反射机制

      Class classType;
      Field field;
      try {
        classType = WebView.class;
        field = classType.getDeclaredField("mZoomButtonsController");
        field.setAccessible(true);
        ZoomButtonsController mZoomButtonsController = new ZoomButtonsController(view);
        mZoomButtonsController.getZoomControls().setVisibility(View.GONE);
        try {
          field.set(view, mZoomButtonsController);
        } catch (IllegalArgumentException e) {
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        }
      } catch (SecurityException e) {
        e.printStackTrace();
      } catch (NoSuchFieldException e) {
        e.printStackTrace();
      }
    }
  }
Exemplo n.º 15
0
 /**
  * 使用检索标准对象查询记录数
  *
  * @param detachedCriteria
  * @return
  */
 @SuppressWarnings("rawtypes")
 public long count(DetachedCriteria detachedCriteria) {
   Criteria criteria = detachedCriteria.getExecutableCriteria(getSession());
   long totalCount = 0;
   try {
     // Get orders
     Field field = CriteriaImpl.class.getDeclaredField("orderEntries");
     field.setAccessible(true);
     List orderEntrys = (List) field.get(criteria);
     // Remove orders
     field.set(criteria, new ArrayList());
     // Get count
     criteria.setProjection(Projections.rowCount());
     totalCount = Long.valueOf(criteria.uniqueResult().toString());
     // Clean count
     criteria.setProjection(null);
     // Restore orders
     field.set(criteria, orderEntrys);
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   }
   return totalCount;
 }
Exemplo n.º 16
0
  /**
   * 将原视图 宽高,padding,margin 按比例重新布
   *
   * @param view
   * @param scale
   */
  public static void relayoutViewWithScale(View view, float scale) {

    if (view == null) {
      return;
    }

    resetViewLayoutParams(view, scale);

    if (view instanceof ViewGroup) {
      View[] where = null;
      try {
        Field field = ViewGroup.class.getDeclaredField("mChildren");
        field.setAccessible(true);
        where = (View[]) field.get(view);
      } catch (NoSuchFieldException e) {
        e.printStackTrace();
      } catch (IllegalArgumentException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      }
      if (where != null) {
        for (View child : where) {
          relayoutViewWithScale(child, scale);
        }
      }
    }
  }
Exemplo n.º 17
0
  /**
   * Update the all the opengl textures belonging to a sketch imediately.
   *
   * @param fs The fullscreen object
   * @throws NoSuchFieldException
   * @throws SecurityException
   * @throws IllegalAccessException
   * @throws IllegalArgumentException
   */
  public static void update(FullScreenBase fs) {
    // Now, if in opengl mode all the textures will be erased,
    // we'll have to call updatePixels() on all of them!
    // Oh, and we have to use reflection, because we don't know if
    // opengl is being used. So the class names might not even be there.
    if (fs.isGL()) {
      try {
        PGraphics g = fs.getSketch().g;
        Field field = PGraphics3D.class.getDeclaredField("textures");
        field.setAccessible(true); // make private variable public!
        PImage textures[] = (PImage[]) field.get(g);

        for (int i = 0; i < textures.length; i++) {
          if (textures[i] != null) {
            textures[i].updatePixels();
          }
        }
      } catch (SecurityException e) {
        System.err.println("FullScreen-API: Unknown error: " + e.getMessage());
        e.printStackTrace();
      } catch (NoSuchFieldException e) {
        System.err.println(
            "FullScreen-API: Couldn't find any field 'textures' in processing.core.PGraphics3D");
        System.err.println(
            "Seems your processing version doesn't match this version of the fullscreen api");
        e.printStackTrace();
      } catch (IllegalArgumentException e) {
        System.err.println("FullScreen-API: Unknown error: " + e.getMessage());
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        System.err.println("FullScreen-API: Unknown error: " + e.getMessage());
        e.printStackTrace();
      }
    }
  }
Exemplo n.º 18
0
  public static Object getStaticFieldOjbect(String class_name, String filedName) {

    try {
      Class obj_class = Class.forName(class_name);
      Field field = obj_class.getDeclaredField(filedName);
      field.setAccessible(true);
      return field.get(null);
    } catch (SecurityException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (NoSuchFieldException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return null;
  }
Exemplo n.º 19
0
 public static Class getClass(String type) {
   try {
     return DataType.class.getDeclaredField(type).getType();
   } catch (NoSuchFieldException noSuchFieldException) {
     noSuchFieldException.printStackTrace();
     return null;
   }
 }
Exemplo n.º 20
0
 public Field getKeyField() {
   try {
     return KeyEvent.class.getField("VK_" + key.toUpperCase());
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   }
   return null; // This shouldn't be reached
 }
Exemplo n.º 21
0
    public HiddenReflector() {

      try {
        mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
        mCursorDrawableRes.setAccessible(true);
      } catch (NoSuchFieldException e) {
        e.printStackTrace();
      }
    }
Exemplo n.º 22
0
 protected Building() {
   try {
     buildingsName = (Buildings) getClass().getField("name").get(null);
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   }
 }
  public static void traverseTags_treatitems(Tag orig, boolean convert) {
    if (orig instanceof CompoundTag) {
      CompoundTag ctagorig = (CompoundTag) orig;
      Collection alltags = ctagorig.getAllTags();
      Iterator it = alltags.iterator();
      level++;
      while (it.hasNext()) {
        traverseTags_treatitems((Tag) it.next(), convert);
      }
      level--;
    }
    if (orig instanceof ListTag) {
      ListTag listTagorig = (ListTag) orig;
      Field list = null;
      Iterator it = null;
      try {
        list = ListTag.class.getDeclaredField("list");
        list.setAccessible(true);
        it = ((List) list.get(listTagorig)).iterator();
      } catch (IllegalArgumentException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (NoSuchFieldException e) {
        e.printStackTrace();
      } catch (SecurityException e) {
        e.printStackTrace();
      }
      level++;
      while (it.hasNext()) {
        // Logger.log(new String(new char[level]).replace("\0", "-")+orig.getId());
        Tag tag = (Tag) it.next();
        if (tag instanceof CompoundTag) {
          CompoundTag ctag = (CompoundTag) tag;
          if (listTagorig.getName().toLowerCase().indexOf("item") == -1) {
            traverseTags_treatitems(ctag, convert);
          } else {
            int ntype = 1;
            int id0 = (int) ctag.getShort("id");
            int id1 = (int) (Integer) ConverterMain.options.getconvertmaps()[1].get(id0)[0];
            count(ntype, id0, id1, convert);

            if (convert) {
              int typefound = (int) (Integer) ConverterMain.options.getconvertmaps()[1].get(id0)[1];
              if (typefound >= 0) {
                if (id0 != id1 && !converteds[ntype].contains(id0)) {
                  ctag.putShort("id", (short) id1);
                }
              }
            }
          }
        }
      }
      level--;
    }
    // Logger.log(new String(new char[level]).replace("\0", "-")+orig.getId());
  }
 static void initField() {
   try {
     nativeIntField = Bitmap.Config.class.getDeclaredField("nativeInt");
     nativeIntField.setAccessible(true);
   } catch (NoSuchFieldException e) {
     nativeIntField = null;
     e.printStackTrace();
   }
 }
Exemplo n.º 25
0
  static {
    try {
      goalSelectorField = EntityInsentient.class.getDeclaredField("goalSelector");
      goalSelectorField.setAccessible(true);

    } catch (NoSuchFieldException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 26
0
  /**
   * lets an instance of Spawner spawn testlevel.json and checks whether the specified Moveables
   * have been created and are in the right position.
   */
  public void testSpawning() {

    GS.enemys = new Vector<Moveable>();
    GS.friendlys = new Vector<Moveable>();
    ;
    initGL();
    GS.deltaUpdater = new DeltaUpdater();
    Spawner s = new Spawner("testlevel", GS.deltaUpdater);
    s.update(400);
    Vector<Observer> observers = null;
    try {
      Field observerField = DeltaUpdater.class.getDeclaredField("observers");
      observerField.setAccessible(true);
      observers = (Vector<Observer>) observerField.get(GS.deltaUpdater);
    } catch (IllegalArgumentException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (SecurityException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (NoSuchFieldException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Gson g = new Gson();
    HashMap<BigDecimal, Spawn[]> LevelMap = null;
    try {
      LevelMap =
          g.fromJson(
              new FileReader("json/level/testlevel.json"),
              (new TypeToken<HashMap<BigDecimal, Spawn[]>>() {}).getType());
    } catch (JsonIOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (JsonSyntaxException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    Spawn[] SpawnArray = LevelMap.get(LevelMap.keySet().toArray()[0]);
    assertTrue(observers.size() == SpawnArray.length + 1);
    // +1 weil Spawner selbst registriert ist
    for (int i = 0; i < observers.size() - 1; ++i) {
      assertTrue(
          ((Entity) observers.get(i + 1)).getClass().getName().equals(SpawnArray[i].Moveable));
      assertTrue(((Entity) observers.get(i + 1)).posX == SpawnArray[i].x);
      assertTrue(((Entity) observers.get(i + 1)).posY == SpawnArray[i].y);
      // assertTrue(((Entity)observers.get(i)).posX == al.get(i).x);

    }
  }
Exemplo n.º 27
0
 static {
   Field segmentReaderSegmentInfoFieldX = null;
   try {
     segmentReaderSegmentInfoFieldX = SegmentReader.class.getDeclaredField("si");
     segmentReaderSegmentInfoFieldX.setAccessible(true);
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   }
   segmentReaderSegmentInfoField = segmentReaderSegmentInfoFieldX;
 }
Exemplo n.º 28
0
 /**
  * Issue a request to save the class level variable. The variable will be updated once {@link
  * ServerData#saveQueue} is called.
  *
  * @param varName The name of the variable.
  */
 private void requestUpdate(String varName) {
   try {
     Field field = ServerData.class.getDeclaredField(varName);
     updateQueue.add(field);
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   } catch (SecurityException e) {
     e.printStackTrace();
   }
 }
 public void setSpinnerValues(String propertyName, ArrayList mainList, Class type, Spinner spn) {
   ArrayList<String> lst = new ArrayList<String>();
   try {
     lst = Generics.getStringList(propertyName, mainList, type);
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   }
   ArrayAdapter<String> adp = new ArrayAdapter<String>(this, R.layout.spinner_item, lst);
   spn.setAdapter(adp);
 }
Exemplo n.º 30
0
 public static Method getFieldSetMethod(Class<?> clazz, String fieldName) {
   try {
     return getFieldSetMethod(clazz, clazz.getDeclaredField(fieldName));
   } catch (SecurityException e) {
     e.printStackTrace();
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   }
   return null;
 }