use of org.yakindu.base.types.Annotation in project statecharts by Yakindu.
the class ExpressionsJavaValidator method checkAnnotationTarget.
@Check(CheckType.FAST)
public void checkAnnotationTarget(final AnnotatableElement element) {
EList<Annotation> annotations = element.getAnnotations();
for (Annotation annotation : annotations) {
EList<EObject> targets = annotation.getType().getTargets();
if (targets.isEmpty())
continue;
boolean found = Iterables.any(targets, new Predicate<EObject>() {
@Override
public boolean apply(EObject input) {
return ((EClass) input).isInstance(element);
}
});
if (!found) {
error(String.format(ERROR_WRONG_ANNOTATION_TARGET_MSG, annotation.getType().getName(), element.eClass()), null, element.getAnnotations().indexOf(annotation), ERROR_WRONG_ANNOTATION_TARGET_CODE);
}
}
}
Aggregations