Esempio n. 1
0
 public static Class findFunctionClass(String name) {
   if (name == null) return null;
   if (name.indexOf('.') < 0) // consider as full qualified name
   name = FUNCTIONS_PACKAGE + name;
   try {
     return Class.forName(name);
   } catch (Error er) {
     // too bad
     logger.severe("Function class " + name + " " + er);
   } catch (Exception ex) {
     logger.severe("Function class " + name + " not found or " + ex);
   }
   return null;
 }
Esempio n. 2
0
 /**
  * @param classOf a target class to find method
  * @param name of method
  * @param paramPattern represents a pattern of parameters, can be list or array of the same type,
  *     if parameter is an array of some class then method with one array of this type searched, if
  *     it's a single class than method with list of parameters of this class searched
  * @return Method if found, and null if not.
  */
 public Method getMethod(Class classOf, String name, Class paramPattern) {
   if (classOf == null) return null;
   Class[] callParamClasses = null;
   if (paramPattern.isArray()) {
     callParamClasses = new Class[1];
     Arrays.fill(callParamClasses, paramPattern);
   } else {
     callParamClasses = new Class[parameters.size()];
     Arrays.fill(callParamClasses, (Class) paramPattern);
   }
   try {
     return classOf.getDeclaredMethod(name, callParamClasses);
   } catch (NoSuchMethodException nsm) {
     if (logger.isLoggable(Level.FINEST))
       logger.finest(
           "Method '"
               + name
               + "' with "
               + callParamClasses.length
               + ", or variable parameters not found, last exception: "
               + nsm);
   }
   return null;
 }