if (annotations != null) {
JSON controllerJSON = new JSON();
config.set(controller.getHandle().getName().toString(), controllerJSON);
for (Map.Entry<AnnotationKey, AnnotationState> entry : annotations.entrySet()) {
AnnotationKey key = entry.getKey();
if (controllerJSON.get("require") != null) {
throw new UnsupportedOperationException("Unsupported multiple requirements at " + key.getElement());
}
if (key.getType().equals(Name.create(RequiresGuest.class))) {
controllerJSON.set("require", "guest");
} else if (key.getType().equals(Name.create(RequiresAuthentication.class))) {
controllerJSON.set("require", "authenticate");
} else if (key.getType().equals(Name.create(RequiresUser.class))) {
controllerJSON.set("require", "user");
}
}
}