Source:
private Set<AnnotationProcessorValidationTarget> getSupportedValidationTargets(AnnotationValue oneValidatorClassReference) { TypeMirror validatorClass = oneValidatorClassReference.accept( new SimpleAnnotationValueVisitor6<TypeMirror, Void>() { @Override public TypeMirror visitType(TypeMirror t, Void p) { return t; } }, null ); DeclaredType validatorType = validatorClass.accept( new TypeKindVisitor6<DeclaredType, Void>() { @Override public DeclaredType visitDeclared(DeclaredType t, Void p) { return t; } }, null ); DeclaredType supportedValidationTargetType = annotationApiHelper.getDeclaredTypeByName( "javax.validation.constraintvalidation.SupportedValidationTarget" ); AnnotationMirror supportedTargetDecl = null; for(AnnotationMirror mirr : validatorType.asElement().getAnnotationMirrors()) { if(typeUtils.isSameType( mirr.getAnnotationType(), supportedValidationTargetType )) { supportedTargetDecl = mirr; break; } } EnumSet<AnnotationProcessorValidationTarget> allowedTargets = EnumSet.noneOf( AnnotationProcessorValidationTarget.class ); if(supportedTargetDecl==null) { allowedTargets.add( AnnotationProcessorValidationTarget.ANNOTATED_ELEMENT ); } else { List<? extends AnnotationValue> values = annotationApiHelper.getAnnotationArrayValue( supportedTargetDecl, "value" ); for(AnnotationValue val : values) { AnnotationProcessorValidationTarget target = val.accept( new SimpleAnnotationValueVisitor6<AnnotationProcessorValidationTarget, Void>() { @Override public AnnotationProcessorValidationTarget visitEnumConstant(VariableElement c, Void p) { return AnnotationProcessorValidationTarget.valueOf( c.getSimpleName().toString() ); } }, null ); allowedTargets.add( target ); } } return allowedTargets; }

Target:
private Set<AnnotationProcessorValidationTarget> getSupportedValidationTargets(AnnotationValue oneValidatorClassReference) { TypeMirror validatorClass = oneValidatorClassReference.accept( new SimpleAnnotationValueVisitor6<TypeMirror, Void>() { @Override public TypeMirror visitType(TypeMirror t, Void p) { return t; } }, null ); DeclaredType validatorType = validatorClass.accept( new TypeKindVisitor6<DeclaredType, Void>() { @Override public DeclaredType visitDeclared(DeclaredType t, Void p) { return t; } }, null ); DeclaredType supportedValidationTargetType = annotationApiHelper.getDeclaredTypeByName( BeanValidationTypes.SUPPORTED_VALIDATION_TARGET ); AnnotationMirror supportedTargetDecl = null; for(AnnotationMirror mirr : validatorType.asElement().getAnnotationMirrors()) { if(typeUtils.isSameType( mirr.getAnnotationType(), supportedValidationTargetType )) { supportedTargetDecl = mirr; break; } } EnumSet<AnnotationProcessorValidationTarget> allowedTargets = EnumSet.noneOf( AnnotationProcessorValidationTarget.class ); if(supportedTargetDecl==null) { allowedTargets.add( AnnotationProcessorValidationTarget.ANNOTATED_ELEMENT ); } else { List<? extends AnnotationValue> values = annotationApiHelper.getAnnotationArrayValue( supportedTargetDecl, "value" ); for(AnnotationValue val : values) { AnnotationProcessorValidationTarget target = val.accept( new SimpleAnnotationValueVisitor6<AnnotationProcessorValidationTarget, Void>() { @Override public AnnotationProcessorValidationTarget visitEnumConstant(VariableElement c, Void p) { return AnnotationProcessorValidationTarget.valueOf( c.getSimpleName().toString() ); } }, null ); allowedTargets.add( target ); } } return allowedTargets; }