All Downloads are FREE. Search and download functionalities are using the official Maven repository.

be.atbash.ee.jsf.jerry.interceptor.exception.SkipRendererDelegationException Maven / Gradle / Ivy

Go to download

Jerry allows you to intercept (define a before and after callback) the main Renderer methods like decode, encodeBegin, encodeChildren, encodeEnd and getConvertedValue.

The newest version!
/*
 * Copyright 2014-2017 Rudy De Busscher
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package be.atbash.ee.jsf.jerry.interceptor.exception;


import be.atbash.ee.jsf.jerry.interceptor.RendererInterceptor;

/**
 * Exception that can be thrown by a
 * ({@link RendererInterceptor})
 * to skip the invocation of the intercepted renderer method.
 *
 * @since 1.x.1
 */
public class SkipRendererDelegationException extends Exception {
    protected RendererInterceptor exceptionSource;
    protected Object information;
    boolean skipOtherInterceptors = false;
    private static final long serialVersionUID = 2343074077532915722L;

    /**
     * Constructor for creating an exception which doesn't skip the invocation of the other interceptors.
     */
    public SkipRendererDelegationException() {
    }

    /**
     * Constructor for creating an exception which might skip the invocation of the other interceptors.
     *
     * @param skipOtherInterceptors signals if the other interceptors should be skipped.
     */
    public SkipRendererDelegationException(boolean skipOtherInterceptors) {
        this.skipOtherInterceptors = skipOtherInterceptors;
    }

    /**
     * Constructor for creating an exception which doesn't skip the invocation of the other interceptors.
     * Furthermore, it allows to get information about the {@link RendererInterceptor} which threw the exception.
     *
     * @param skipOtherInterceptors signals if the other interceptors should be skipped.
     * @param rendererInterceptor   interceptor which threw this exception.
     */
    public SkipRendererDelegationException(boolean skipOtherInterceptors, RendererInterceptor rendererInterceptor) {
        this(skipOtherInterceptors);
        this.exceptionSource = rendererInterceptor;
    }

    /**
     * Sets an additional object with information.
     *
     * @param information some additional information.
     */
    public void setInformation(Object information) {
        this.information = information;
    }

    /**
     * Returns the additional information.
     *
     * @return the additional information.
     */
    public Object getInformation() {
        return information;
    }

    /**
     * Signals if the subsequent interceptors should be skipped.
     *
     * @return true if the subsequent interceptors should be skipped, false otherwise
     */
    public boolean isSkipOtherInterceptors() {
        return skipOtherInterceptors;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy