- All Implemented Interfaces:
Serializable
This specialized MethodExpression
enables the evaluation of composite component expressions. Instances
of this expression will be created when
TagAttributeImpl.getValueExpression(jakarta.faces.view.facelets.FaceletContext, Class)
is invoked and the expression represents a composite component expression (i.e. #{cc.[properties]}).
It's important to note that these MethodExpression
s are context sensitive in that they leverage the
location in which they were referenced in order to push the proper composite component to the evaluation context
prior to evaluating the expression itself.
Using Page test.xhtml --------------------------------- <ez:comp1 do="#{bean.action}" /> comp1.xhtml --------------------------------- <composite:interface> <composite:attribute name="do" method-signature="String f()" required="true" /> </composite:interface> <composite:implementation> <ez:nesting> <h:commandButton value="Click Me!" action="#{cc.attrs.do} /> </ez:nesting> </composite:implementation> nesting.xhtml --------------------------------- <composite:interface /> <composite:implementation> <composite:insertChildren> </composite:implementation>When
commandButton
is clicked, the ContextualCompositeMethodExpression
first is looked up
by
invalid reference
com.sun.faces.facelets.tag.TagAttributeImpl.AttributeLookupMethodExpression
ContextualCompositeMethodExpression
. When this
ContextualCompositeMethodExpression
is invoked, the Location
object necessary to find the proper composite component will be derived from
source ValueExpression
provided at construction time.
Using the derived
Location
, we can find the composite component that matches 'owns' the template in which
the expression was defined in by comparing the path of the Location with the name and library of the
Resource
instance associated with each composite component. If a matching composite
component is found, it will be made available to the EL by calling
CompositeComponentStackManager.push(jakarta.faces.component.UIComponent)
.- See Also:
-
Constructor Summary
ConstructorDescriptionContextualCompositeMethodExpression
(ValueExpression source, MethodExpression delegate) ContextualCompositeMethodExpression
(Location location, MethodExpression delegate) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines whether the specified object is equal to thisExpression
.Returns the original String used to create thisExpression
, unmodified.getMethodInfo
(ELContext elContext) Evaluates the expression relative to the provided context, and returns information about the actual referenced method.int
hashCode()
Returns the hash code for thisExpression
.If a String literal is specified as the expression, returns the String literal coerced to the expected return type of the method signature.boolean
Returns whether this expression was created from only literal text.Methods inherited from class jakarta.el.MethodExpression
getMethodReference, isParametersProvided
-
Constructor Details
-
ContextualCompositeMethodExpression
-
ContextualCompositeMethodExpression
-
-
Method Details
-
getMethodInfo
Description copied from class:MethodExpression
Evaluates the expression relative to the provided context, and returns information about the actual referenced method.- Specified by:
getMethodInfo
in classMethodExpression
- Parameters:
elContext
- The context of this evaluation- Returns:
- an instance of
MethodInfo
containing information about the method the expression evaluated to.
-
invoke
Description copied from class:MethodExpression
If a String literal is specified as the expression, returns the String literal coerced to the expected return type of the method signature. AnELException
is thrown ifexpectedReturnType
is void or if the coercion of the String literal to theexpectedReturnType
yields an error (see Section "1.18 Type Conversion" of the Jakarta Expression Language specification). If not a String literal, evaluates the expression relative to the provided context, invokes the method that was found using the supplied parameters, and returns the result of the method invocation. Any parameters passed to this method is ignored if isLiteralText() or isParametersProvided() is true.- Specified by:
invoke
in classMethodExpression
- Parameters:
elContext
- The context of this evaluation.objects
- The parameters to pass to the method, ornull
if no parameters.- Returns:
- the result of the method invocation (
null
if the method has avoid
return type).
-
getExpressionString
Description copied from class:Expression
Returns the original String used to create thisExpression
, unmodified.This is used for debugging purposes but also for the purposes of comparison (e.g. to ensure the expression in a configuration file has not changed).
This method does not provide sufficient information to re-create an expression. Two different expressions can have exactly the same expression string but different function mappings. Serialization should be used to save and restore the state of an
Expression
.- Specified by:
getExpressionString
in classExpression
- Returns:
- The original expression String.
-
equals
Description copied from class:Expression
Determines whether the specified object is equal to thisExpression
.The result is
true
if and only if the argument is notnull
, is anExpression
object that is the of the same type (ValueExpression
orMethodExpression
), and has an identical parsed representation.Note that two expressions can be equal if their expression Strings are different. For example,
${fn1:foo()}
and${fn2:foo()}
are equal if their correspondingFunctionMapper
s mappedfn1:foo
andfn2:foo
to the same method.- Specified by:
equals
in classExpression
- Parameters:
o
- theObject
to test for equality.- Returns:
true
ifobj
equals thisExpression
;false
otherwise.- See Also:
-
hashCode
public int hashCode()Description copied from class:Expression
Returns the hash code for thisExpression
.See the note in the
Expression.equals(java.lang.Object)
method on how two expressions can be equal if their expression Strings are different. Recall that if two objects are equal according to theequals(Object)
method, then calling thehashCode
method on each of the two objects must produce the same integer result. Implementations must take special note and implementhashCode
correctly.- Specified by:
hashCode
in classExpression
- Returns:
- The hash code for this
Expression
. - See Also:
-
isLiteralText
public boolean isLiteralText()Description copied from class:Expression
Returns whether this expression was created from only literal text.This method must return
true
if and only if the expression string this expression was created from contained no unescaped Jakarta Expression Language delimeters (${...}
or#{...}
).- Specified by:
isLiteralText
in classExpression
- Returns:
true
if this expression was created from only literal text;false
otherwise.
-