Search in sources :

Example 1 with Guards

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;
}
Also used : ArrayList(java.util.ArrayList) Guards(com.manydesigns.portofino.operations.annotations.Guards) Guard(com.manydesigns.portofino.operations.annotations.Guard)

Aggregations

Guard (com.manydesigns.portofino.operations.annotations.Guard)1 Guards (com.manydesigns.portofino.operations.annotations.Guards)1 ArrayList (java.util.ArrayList)1