Beispiel #1
0
 public static UText forfield(Furnace fnd, final Object obj, String fn) {
   final java.lang.reflect.Field f;
   try {
     f = obj.getClass().getField(fn);
   } catch (NoSuchFieldException e) {
     throw (new RuntimeException(e));
   }
   if (f.getType() != String.class) throw (new RuntimeException("Not a string field: " + f));
   return (new UText(fnd) {
     public String text() {
       try {
         return ((String) f.get(obj));
       } catch (IllegalAccessException e) {
         throw (new RuntimeException(e));
       }
     }
   });
 }