private static boolean isConstraintInActionChain(final Action<?> action, final Function<Action<?>, Action<?>> nextAction) {
        if(action != null) {
            if(action instanceof AbstractDeadboltAction &&
                    !(action instanceof BeforeAccessAction) &&
                    !(action instanceof DeferredDeadboltAction)) {
                return true;
            }
            // that wasn't a deadbolt constraint, let's go and check the next action in the chain
            return isConstraintInActionChain(nextAction.apply(action), nextAction);
        }
        return false;
    }
private static boolean isConstraintInActionChain(final Action<?> action, final Function<Action<?>, Action<?>> nextAction) {
        if(action != null) {
            if(action instanceof AbstractDeadboltAction &&
                    !(action instanceof BeforeAccessAction) &&
                    !(action instanceof DeferredDeadboltAction)) {
                return true;
            }
            
            return isConstraintInActionChain(nextAction.apply(action), nextAction);
        }
        return false;
    }
private static boolean isConstraintInActionChain ( final Action < ? > action , final Function < Action < ? > , Action < ? > > nextAction ) { if ( action != null ) { if ( action instanceof AbstractDeadboltAction && ! ( action instanceof BeforeAccessAction ) && ! ( action instanceof DeferredDeadboltAction ) ) { return true ; } // that wasn't a deadbolt constraint, let's go and check the next action in the chain return isConstraintInActionChain ( nextAction . apply ( action ) , nextAction ) ; } return false ; }
Be aware: Not every deadbolt-annotation is a constraint, but every constraint is a deadbolt-annotation ;)
@BeforeAccess and @DeferredDeadboltAction do NOT count as constraint, because they just pass trough (=they do NOT call markAsAuthorised() in success case)
Be aware : Not every deadbolt - annotation is a constraint but every constraint is a deadbolt - annotation ; )