List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
for (AnnotationMirror mirror : annotationMirrors) {
final String annotationType = mirror.getAnnotationType().toString();
if (annotationType.equals(NameToken.class.getName())) {
NameToken nameToken = element.getAnnotation(NameToken.class);
AccessControl accessControl = element.getAnnotation(AccessControl.class);
if (accessControl != null) {
for (String resourceAddress : accessControl.resources()) {
AccessControlMetaData declared = new AccessControlMetaData(
nameToken.value(), resourceAddress
);
declared.setRecursive(accessControl.recursive());
accessControlDeclararions.add(declared);
}
for (String opString : accessControl.operations()) {
if (!opString.contains("#")) {
throw new IllegalArgumentException("Invalid operation string:" + opString);
}
BootstrapOperation op = new BootstrapOperation(
nameToken.value(), opString
);
bootstrapOperations.add(op);
}
} else if (element.getAnnotation(NoGatekeeper.class) == null) {
Name simpleName = element.getEnclosingElement() != null ? element.getEnclosingElement()
.getSimpleName() : element.getSimpleName();
System.out.println(
simpleName + "(#" + nameToken.value() + ")" + " is missing @AccessControl annotation!");
}
}
}
}