Code example for Predicate

Methods: apply

    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);
    public void setPredicate(Predicate<HttpServletRequest> predicate) {
        this.predicate = predicate;