String permission;
PermitAll permitAll = annotation.methodElem.getAnnotation(PermitAll.class);
if (permitAll != null) {
permission = "open()";
} else {
RolesAllowed rolesAllowed = annotation.methodElem.getAnnotation(RolesAllowed.class);
if (rolesAllowed != null) {
List<String> roles = new ArrayList<>();
for (String role : rolesAllowed.value()) {
roles.add("hasRole(\"" + role + "\")");
}
switch (roles.size()) {
case 0:
permission = "isAuthenticated()";