A variable mapper which holds the variables of one tag file invocation on top of a wrapped one.
A variable can be declared, which marks it as a tag attribute of that tag file invocation, or set, which is the ordinary variable mapper contract as used by
<c:set> and <ui:param>. Only a declared variable is shielded from a nested tag file invocation, and only a declared
variable also remembers the value which it inherited at the moment of declaring, its boundary value.
A nested instance therefore treats an inherited value as not inherited when it equals either the declared value or the boundary value of an enclosing instance. Both are looked up through the wrapped mapper under a prefixed name, so that they are also found when the Faces implementation puts its own variable mapper in between, which Mojarra does as soon as the nested tag file is passed an attribute of its own. The boundary value is what makes this work on MyFaces as well, whose variable mapper is dynamic and answers for the tag file which is currently being applied.
- Since:
- 2.1
- Author:
- Arjan Tijms.
-
Constructor Summary
ConstructorsConstructorDescriptionDelegatingVariableMapper(VariableMapper wrapped) Construct delegating variable mapper. -
Method Summary
Modifier and TypeMethodDescriptiondeclareVariable(String name, ValueExpression expression) Declares the given name as a tag attribute of the tag file invocation which this mapper represents, remembering the value which it inherits at this moment, so that a nested tag file invocation can recognize the declaration as not being its own.resolveVariable(String name) resolveWrappedVariable(String name) Returns the value which this mapper inherits for the given name, ornullwhen that value is merely the declaration of an enclosing mapper and therefore not inherited at all.setVariable(String name, ValueExpression expression)
-
Constructor Details
-
DelegatingVariableMapper
Construct delegating variable mapper.- Parameters:
wrapped- The variable mapper to be wrapped.
-
-
Method Details
-
resolveVariable
- Specified by:
resolveVariablein classVariableMapper
-
resolveWrappedVariable
Returns the value which this mapper inherits for the given name, ornullwhen that value is merely the declaration of an enclosing mapper and therefore not inherited at all.- Parameters:
name- Name of the variable.- Returns:
- The inherited value, or
nullwhen there is none.
-
declareVariable
Declares the given name as a tag attribute of the tag file invocation which this mapper represents, remembering the value which it inherits at this moment, so that a nested tag file invocation can recognize the declaration as not being its own.- Parameters:
name- Name of the variable.expression- Value expression of the variable.- Returns:
- The previous value expression of the variable.
-
setVariable
- Specified by:
setVariablein classVariableMapper
-