jakarta.faces.context.PartialViewContextWrapper Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.faces.context;
import java.util.Collection;
import java.util.List;
import jakarta.faces.FacesWrapper;
import jakarta.faces.event.PhaseId;
/**
*
* Provides a simple implementation of
* {@link PartialViewContext} that can be subclassed by developers wishing to provide specialized behavior to an
* existing {@link PartialViewContext} instance. The default implementation of all methods is to call through to the
* wrapped {@link ExternalContext} instance.
*
*
*
* Usage: extend this class and push the implementation being wrapped to the constructor and use {@link #getWrapped} to
* access the instance being wrapped.
*
*
* @since 2.0
*/
public abstract class PartialViewContextWrapper extends PartialViewContext implements FacesWrapper {
private PartialViewContext wrapped;
/**
* @deprecated Use the other constructor taking the implementation being wrapped.
*/
@Deprecated
public PartialViewContextWrapper() {
}
/**
*
* If this partial view context has been decorated, the implementation doing the decorating should push the
* implementation being wrapped to this constructor. The {@link #getWrapped()} will then return the implementation being
* wrapped.
*
*
* @param wrapped The implementation being wrapped.
* @since 2.3
*/
public PartialViewContextWrapper(PartialViewContext wrapped) {
this.wrapped = wrapped;
}
@Override
public PartialViewContext getWrapped() {
return wrapped;
}
// ----------------------------------------- Methods from PartialViewContext
/**
*
* The default behavior of this method is to call {@link PartialViewContext#getExecuteIds()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#getExecuteIds()
*/
@Override
public Collection getExecuteIds() {
return getWrapped().getExecuteIds();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#getRenderIds()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#getRenderIds()
*/
@Override
public Collection getRenderIds() {
return getWrapped().getRenderIds();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#getRenderIds()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#getEvalScripts()
*/
@Override
public List getEvalScripts() {
return getWrapped().getEvalScripts();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#getPartialResponseWriter()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#getPartialResponseWriter()
*/
@Override
public PartialResponseWriter getPartialResponseWriter() {
return getWrapped().getPartialResponseWriter();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#setPartialRequest(boolean)} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#setPartialRequest(boolean)
*/
@Override
public void setPartialRequest(boolean isPartialRequest) {
getWrapped().setPartialRequest(isPartialRequest);
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#isAjaxRequest()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see jakarta.faces.context.PartialViewContext#isAjaxRequest()
*/
@Override
public boolean isAjaxRequest() {
return getWrapped().isAjaxRequest();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#isPartialRequest()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#isPartialRequest()
*/
@Override
public boolean isPartialRequest() {
return getWrapped().isPartialRequest();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#isExecuteAll()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#isExecuteAll()
*/
@Override
public boolean isExecuteAll() {
return getWrapped().isExecuteAll();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#isRenderAll()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#isRenderAll()
*/
@Override
public boolean isRenderAll() {
return getWrapped().isRenderAll();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#isResetValues()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#isResetValues()
*/
@Override
public boolean isResetValues() {
return getWrapped().isResetValues();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#setRenderAll(boolean)} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#setRenderAll(boolean)
*/
@Override
public void setRenderAll(boolean renderAll) {
getWrapped().setRenderAll(renderAll);
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#release()} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#release()
*/
@Override
public void release() {
getWrapped().release();
}
/**
*
* The default behavior of this method is to call {@link PartialViewContext#processPartial(PhaseId)} on the wrapped
* {@link PartialViewContext} object.
*
*
* @see PartialViewContext#processPartial(PhaseId)
*/
@Override
public void processPartial(PhaseId phaseId) {
getWrapped().processPartial(phaseId);
}
}