Code example for Predicate

Methods: apply

0
    public void renderState(final HttpServletRequest request, final HttpServletResponse response)
            throws ServletException, IOException {
 
        // render either the true or false pipe, depending on the trueness or falseness of the predicate 
 
        if (predicate.apply(request)) {
            logger.trace("Branching to the true pipe [{}].", truePipe);
            truePipe.renderState(request, response);
        } else { 
            logger.trace("Branching to the false pipe [{}].", falsePipe);
            falsePipe.renderState(request, response);
        } 
 
    } 
 
    @Required 
    public void setPredicate(Predicate<HttpServletRequest> predicate) {
        this.predicate = predicate;
    }