pattern = p;
argNames = new String[method.getParameterTypes().length];
argTypes = new Class[argNames.length];
for (int i = 0; i < argNames.length; i++) {
Named name = null;
for (Annotation a : method.getParameterAnnotations()[i]) {
if (a instanceof Named) {
name = (Named) a;
break;
}
}
if (name == null) {
throw new RuntimeException("Argument " + (i + 1) + " of "
+ m.toGenericString() + " in " + m.getDeclaringClass()
+ " has no @Named annotation");
}
if (!Predicate.class.isAssignableFrom(method.getParameterTypes()[i])) {
throw new RuntimeException("Argument " + (i + 1) + " of "
+ m.toGenericString() + " in " + m.getDeclaringClass()
+ " must be of type " + Predicate.class);
}
argNames[i] = name.value();
argTypes[i] = (Class<Predicate<T>>) method.getParameterTypes()[i];
}
}