*/
public void handle(Annotation annotation, Method element, FromAnnotationsRuleSet ruleSet) {
if (SUPPORTED_ARGS != element.getParameterTypes().length) {
DigesterRule rule = annotation.annotationType().getAnnotation(DigesterRule.class);
throw new DigesterLoadingException("Methods annotated with digester annotation rule @"
+ rule.reflectsRule().getName()
+ " must have just one argument");
}
Object explicitTypesObject = AnnotationUtils.getAnnotationValue(annotation);
if (explicitTypesObject == null
|| !explicitTypesObject.getClass().isArray()
|| Class.class != explicitTypesObject.getClass().getComponentType()) {
throw new DigesterLoadingException("Impossible to apply this handler, @"
+ annotation.getClass().getName()
+ ".value() has to be of type 'Class<?>[]'");
}
Class<?>[] explicitTypes = (Class<?>[]) explicitTypesObject;
Class<?> paramType = element.getParameterTypes()[0];
if (explicitTypes.length > 0) {
for (Class<?> explicitType : explicitTypes) {
if (!paramType.isAssignableFrom(explicitType)) {
throw new DigesterLoadingException("Impossible to handle annotation "
+ annotation
+ " on method "
+ element.toGenericString()
+ ", "
+ explicitType.getName()