Ejemplo n.º 1
0
 public static Method[] findMethodsByName(Class<?> type, String methodName) {
   ArrayBuilder<Method> builder = new ArrayBuilder<Method>(Method.class);
   for (Method method : type.getMethods()) {
     if (methodName.equals(method.getName())) builder.add(method);
   }
   return builder.toArray();
 }
Ejemplo n.º 2
0
 public static Method[] findMethodsByAnnotation(
     Class<?> owner, Class<? extends Annotation> annotationClass) {
   Method[] methods = owner.getMethods();
   ArrayBuilder<Method> builder = new ArrayBuilder<Method>(Method.class);
   for (Method method : methods)
     if (method.getAnnotation(annotationClass) != null) builder.add(method);
   return builder.toArray();
 }