use of com.manydesigns.portofino.operations.annotations.Guards in project Portofino by ManyDesigns.
the class Operations method getGuards.
public static List<Guard> getGuards(Method method, GuardType type) {
List<Guard> guardList = new ArrayList<Guard>();
Guard guard = method.getAnnotation(Guard.class);
if (guard != null && (type == null || type == guard.type())) {
guardList.add(guard);
} else {
Guards guards = method.getAnnotation(Guards.class);
if (guards != null) {
for (Guard g : guards.value()) {
if (type == null || type == g.type()) {
guardList.add(g);
}
}
}
}
return guardList;
}