Exemple #1
0
 public static void setStatsMap(HashMap<String, TableStats> s) {
   try {
     java.lang.reflect.Field statsMapF = TableStats.class.getDeclaredField("statsMap");
     statsMapF.setAccessible(true);
     statsMapF.set(null, s);
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
   } catch (SecurityException e) {
     e.printStackTrace();
   } catch (IllegalArgumentException e) {
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     e.printStackTrace();
   }
 }
Exemple #2
0
 public Y call(X value) {
   Class cls = value.getClass();
   try {
     Field f = cls.getField(fieldName);
     return (Y) f.get(value);
   } catch (SecurityException e) {
     e.printStackTrace();
     throw new IllegalStateException();
   } catch (NoSuchFieldException e) {
     e.printStackTrace();
     throw new IllegalStateException();
   } catch (IllegalAccessException e) {
     e.printStackTrace();
     throw new IllegalStateException();
   }
 }
Exemple #3
0
  public Predicted(DataFrame<M> f, String pfn) {
    frame = f;
    numericField = null;

    Class<M> mcls = frame.getModelClass();

    try {
      Field mf = mcls.getField(pfn);
      Class t = mf.getType();
      if (Model.isSubclass(t, Number.class)) {
        numericField = mf;
      } else {
        throw new IllegalArgumentException(
            String.format("Field %s is not numeric", pfn, t.getName()));
      }

    } catch (NoSuchFieldException e) {
      e.printStackTrace();
      throw new IllegalArgumentException(String.format("Unknown field name: %s", pfn));
    }
  }
 static {
   try {
     Class bootCls = Class.forName("bluej.Boot");
     Field field = bootCls.getField("GREENFOOT_API_VERSION");
     String versionStr = (String) field.get(null);
     VERSION = new Version(versionStr);
   } catch (ClassNotFoundException e) {
     VERSION = new Version("0");
     // It's fine - running in standalone.
   } 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();
   }
 }