private void validateClassAnnotation(IClassDefinition definition, IMetaTag tag) { IAnnotationDefinition annotation = manager.getAnnotation(tag); if (annotation == null) { // XXX (Annotation) AnnotationNotDefinedProblem manager.addProblem(new AnnotationProblem(definition)); return; } if (!annotation.isValidTarget(definition)) { // XXX (Annotation) InvlaidTargetForAnnotationProblem manager.addProblem(new AnnotationProblem(definition)); } }
private void validateMemberAnnotation(IDefinition definition, IMetaTag tag) { IAnnotationDefinition annotation = manager.getAnnotation(tag); if (annotation == null) { // XXX (Annotation) AnnotationNotDefinedProblem manager.addProblem(new AnnotationProblem(definition)); return; } if (!annotation.isValidTarget(definition)) { // XXX (Annotation) InvlaidTargetForAnnotationProblem manager.addProblem( new InvlaidTargetForAnnotationProblem(tag, "method", annotation.getQualifiedName())); } }
@Override public boolean visitClass(IClassDefinition definition) { if (manager.isAnnotation(definition)) return true; // find out if the class is annotated which in this context means // any metadata at all IMetaTag[] tags = definition.getAllMetaTags(); for (IMetaTag tag : tags) { validateClassAnnotation(definition, tag); } return true; }