Top Description Fields Constructors Methods
com.sun.faces.facelets.el

public final Class ContextualCompositeValueExpression

extends ValueExpression
Class Inheritance
Imports
com.sun.faces.component.CompositeComponentStackManager, jakarta.el.ELContext, .ValueExpression, .ValueReference, jakarta.faces.component.UIComponent, jakarta.faces.context.FacesContext, jakarta.faces.view.Location

This specialized ValueExpression enables the evaluation of composite component expressions. Instances of this expression will be created when com.sun.faces.facelets.tag.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 ValueExpressions 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.

Here's an example:
Using Page test.xhtml
---------------------------------
   <ez:comp1 greeting="Hello!" />


comp1.xhtml
---------------------------------
<composite:interface>
   <composite:attribute name="greeting" type="java.lang.String" required="true" />
</composite:interface>
<composite:implementation>
   <ez:nesting>
      <h:outputText value="#{cc.attrs.greetings}" />
   </ez:nesting>
</composite:implementation>

nesting.xhtml
---------------------------------
<composite:interface />
<composite:implementation>
   <composite:insertChildren>
</composite:implementation>

In the above example, there will be two composite components available to the runtime: ez:comp1 and ez:nesting.

When <h:outputText value="#{cc.attrs.greeting}" />, prior to attempting to evaluate the expression, the Location object will be used to find the composite component that 'owns' the template in which the expression was defined in by comparing the path of the Location with the name and library of the jakarta.faces.application.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).

Field Summary

Modifier and TypeField and Description
private Location
private ValueExpression
private static final long

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the Object to test for equality.
o
)

Implements abstract jakarta.el.Expression.equals.

Determines whether the specified object is equal to this Expression.

public Class<?>
getExpectedType()

Implements abstract jakarta.el.ValueExpression.getExpectedType.

Returns the type the result of the expression will be coerced to after evaluation.

public String
getExpressionString()

Implements abstract jakarta.el.Expression.getExpressionString.

Returns the original String used to create this Expression, unmodified.

public Location

Returns:

the Location of this ValueExpression
getLocation
()

public Class<?>
getType(ELContext
The context of this evaluation.
elContext
)

Implements abstract jakarta.el.ValueExpression.getType.

Evaluates the expression relative to the provided context, and returns the most general type that is acceptable for an object to be passed as the value parameter in a future call to the setValue method.

public Object
getValue(ELContext
The context of this evaluation.
elContext
)

Implements abstract jakarta.el.ValueExpression.getValue.

Evaluates the expression relative to the provided context, and returns the resulting value.

public ValueReference
getValueReference(ELContext
the context of this evaluation
elContext
)

Overrides jakarta.el.ValueExpression.getValueReference.

Returns a ValueReference for this expression instance.

public int
hashCode()

Implements abstract jakarta.el.Expression.hashCode.

Returns the hash code for this Expression.

public boolean
isLiteralText()

Implements abstract jakarta.el.Expression.isLiteralText.

Returns whether this expression was created from only literal text.

public boolean
isReadOnly(ELContext
The context of this evaluation.
elContext
)

Implements abstract jakarta.el.ValueExpression.isReadOnly.

Evaluates the expression relative to the provided context, and returns true if a call to setValue will always fail.

private void
private boolean
public void
setValue(ELContext
The context of this evaluation.
elContext
,
Object
The new value to be set.
o
)

Implements abstract jakarta.el.ValueExpression.setValue.

Evaluates the expression relative to the provided context, and sets the result to the provided value.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

locationback to summary
private Location location
originalVEback to summary
private ValueExpression originalVE
serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.el.ValueExpression.serialVersionUID.

Constructor Detail

ContextualCompositeValueExpressionback to summary
public ContextualCompositeValueExpression()
ContextualCompositeValueExpressionback to summary
public ContextualCompositeValueExpression(Location location, ValueExpression originalVE)

Method Detail

equalsback to summary
public boolean equals(Object o)

Implements abstract jakarta.el.Expression.equals.

Doc from jakarta.el.Expression.equals.

Determines whether the specified object is equal to this Expression.

The result is true if and only if the argument is not null, is an Expression object that is the of the same type (ValueExpression or MethodExpression), 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 corresponding FunctionMappers mapped fn1:foo and fn2:foo to the same method.

Parameters
o:Object

the Object to test for equality.

Returns:boolean

true if obj equals this Expression; false otherwise.

Annotations
@SuppressWarnings:EqualsWhichDoesntCheckParameterClass
@Override
getExpectedTypeback to summary
public Class<?> getExpectedType()

Implements abstract jakarta.el.ValueExpression.getExpectedType.

Doc from jakarta.el.ValueExpression.getExpectedType.

Returns the type the result of the expression will be coerced to after evaluation.

Returns:Class<?>

the expectedType passed to the ExpressionFactory.createValueExpression method that created this ValueExpression.

Annotations
@Override
getExpressionStringback to summary
public String getExpressionString()

Implements abstract jakarta.el.Expression.getExpressionString.

Doc from jakarta.el.Expression.getExpressionString.

Returns the original String used to create this Expression, 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.

Returns:String

The original expression String.

Annotations
@Override
getLocationback to summary
public Location getLocation()
Returns:Location

the Location of this ValueExpression

getTypeback to summary
public Class<?> getType(ELContext elContext)

Implements abstract jakarta.el.ValueExpression.getType.

Doc from jakarta.el.ValueExpression.getType.

Evaluates the expression relative to the provided context, and returns the most general type that is acceptable for an object to be passed as the value parameter in a future call to the setValue method.

This is not always the same as getValue().getClass(). For example, in the case of an expression that references an array element, the getType method will return the element type of the array, which might be a superclass of the type of the actual element that is currently in the specified array element.

Parameters
elContext:ELContext

The context of this evaluation.

Returns:Class<?>

the most general acceptable type; otherwise undefined.

Annotations
@Override
getValueback to summary
public Object getValue(ELContext elContext)

Implements abstract jakarta.el.ValueExpression.getValue.

Doc from jakarta.el.ValueExpression.getValue.

Evaluates the expression relative to the provided context, and returns the resulting value.

The resulting value is automatically coerced to the type returned by getExpectedType(), which was provided to the ExpressionFactory when this expression was created.

Parameters
elContext:ELContext

The context of this evaluation.

Returns:Object

The result of the expression evaluation.

Annotations
@Override
getValueReferenceback to summary
public ValueReference getValueReference(ELContext elContext)

Overrides jakarta.el.ValueExpression.getValueReference.

Doc from jakarta.el.ValueExpression.getValueReference.

Returns a ValueReference for this expression instance.

Parameters
elContext:ELContext

the context of this evaluation

Returns:ValueReference

the ValueReference for this ValueExpression, or null if this ValueExpression is not a reference to a base (null or non-null) and a property. If the base is null, and the property is a Jakarta Expression Language variable, return the ValueReference for the ValueExpression associated with this Jakarta Expression Language variable.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract jakarta.el.Expression.hashCode.

Doc from jakarta.el.Expression.hashCode.

Returns the hash code for this Expression.

See the note in the equals method on how two expressions can be equal if their expression Strings are different. Recall that if two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. Implementations must take special note and implement hashCode correctly.

Returns:int

The hash code for this Expression.

Annotations
@Override
isLiteralTextback to summary
public boolean isLiteralText()

Implements abstract jakarta.el.Expression.isLiteralText.

Doc from jakarta.el.Expression.isLiteralText.

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 #{...}).

Returns:boolean

true if this expression was created from only literal text; false otherwise.

Annotations
@Override
isReadOnlyback to summary
public boolean isReadOnly(ELContext elContext)

Implements abstract jakarta.el.ValueExpression.isReadOnly.

Doc from jakarta.el.ValueExpression.isReadOnly.

Evaluates the expression relative to the provided context, and returns true if a call to setValue will always fail.

Parameters
elContext:ELContext

The context of this evaluation.

Returns:boolean

true if the expression is read-only or false if not.

Annotations
@Override
popCompositeComponentback to summary
private void popCompositeComponent(FacesContext ctx)
pushCompositeComponentback to summary
private boolean pushCompositeComponent(FacesContext ctx)
setValueback to summary
public void setValue(ELContext elContext, Object o)

Implements abstract jakarta.el.ValueExpression.setValue.

Doc from jakarta.el.ValueExpression.setValue.

Evaluates the expression relative to the provided context, and sets the result to the provided value.

Parameters
elContext:ELContext

The context of this evaluation.

o:Object

The new value to be set.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override