public static <T> T invoke(String m, Object... args) throws Throwable {
   Class claseDelMetodoALlamar = null;
   List<Class> classes = Play.classloader.getAssignableClasses(JustificacionFapController.class);
   if (classes.size() != 0) {
     claseDelMetodoALlamar = classes.get(0);
   } else {
     return (T) Java.invokeStatic(JustificacionFapController.class, m, args);
   }
   try {
     return (T) Java.invokeStaticOrParent(claseDelMetodoALlamar, m, args);
   } catch (InvocationTargetException e) {
     throw e.getTargetException();
   }
 }
예제 #2
0
 public static ObjectType get(Class<? extends Controller> controllerClass) {
   Class<? extends Model> entityClass = getEntityClassForController(controllerClass);
   if (entityClass == null || !Model.class.isAssignableFrom(entityClass)) {
     return null;
   }
   ObjectType type;
   try {
     type =
         (ObjectType)
             Java.invokeStaticOrParent(controllerClass, "createObjectType", entityClass);
   } catch (Exception e) {
     Logger.error(e, "Couldn't create an ObjectType. Use default one.");
     type = new ObjectType(entityClass);
   }
   type.name = controllerClass.getSimpleName().replace("$", "");
   type.controllerName = controllerClass.getSimpleName().toLowerCase().replace("$", "");
   type.controllerClass = controllerClass;
   return type;
 }