Optionals.
This resolver handles base objects that are instances of Optional.
This resolver is always a read-only resolver since Optional instances are immutable.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public <T> T | Returns: If the base object is anOptional and Optional#isEmpty() returns true then this
method returns the result of coercing null to the requested type.
If the base object is an
If the base object is not an The context of this evaluation. context, Object The object to convert. obj, Class<T> The target type for the conversion. type)Overrides jakarta. Converts an object to a specific type. |
| public Class | getCommonPropertyType(ELContext
The context of this evaluation. context, Object The base object to return the most general property type for, or base)null to enumerate the set
of top-level variables that this resolver can evaluate.Implements abstract jakarta. Returns the most general type that this resolver accepts for the |
| public Class | getType(ELContext
The context of this evaluation. context, Object The base object whose property value is to be analyzed, or base, Object null to analyze a top-level
variable.The property or variable to return the acceptable type for. property)Implements abstract jakarta. For a given |
| public Object | Returns: If the base object is anOptional and Optional#isEmpty() returns true then the
resulting value is null.
If the base object is an
If the base object is an
If the base object is not an The context of this evaluation. context, Object The base object whose property value is to be returned, or base, Object null to resolve a top-level
variable.The property or variable to be resolved. property)Implements abstract jakarta. Attempts to resolve the given |
| public Object | Returns: If the base object is anOptional and Optional#isEmpty() returns true then this
method returns null.
If the base object is an
If the base object is not an The context of this evaluation. context, Object The bean on which to invoke the method base, Object The simple name of the method to invoke. Will be coerced to a method, Class<?>[] String.An array of Class objects identifying the method's formal parameter types, in declared order. Use
an empty array if the method has no parameters. Can be paramTypes, Object[] null, in which case the method's formal parameter
types are assumed to be unknown.The parameters to pass to the method, or params)null if no parameters.Overrides jakarta. Attempts to resolve and invoke the given |
| public boolean | isReadOnly(ELContext
The context of this evaluation. context, Object The base object whose property value is to be analyzed, or base, Object null to analyze a top-level
variable.The property or variable to return the read-only status for. property)Implements abstract jakarta. For a given |
| public void | setValue(ELContext
The context of this evaluation. context, Object The base object whose property value is to be set, or base, Object null to set a top-level variable.The property or variable to be set. property, Object The value to set the property or variable to. value)Implements abstract jakarta. Attempts to set the value of the given |
| OptionalELResolver | back to summary |
|---|---|
| public OptionalELResolver() | |
| convertToType | back to summary |
|---|---|
| public <T> T convertToType(ELContext context, Object obj, Class<T> type) Overrides jakarta. Doc from jakarta. Converts an object to a specific type.
An
| |
| getCommonPropertyType | back to summary |
|---|---|
| public Class Implements abstract jakarta. Doc from jakarta. Returns the most general type that this resolver accepts for the
This assists tools in auto-completion and also provides a way to express that the resolver accepts a primitive value,
such as an integer index into an array. For example, the | |
| getType | back to summary |
|---|---|
| public Class Implements abstract jakarta. Doc from jakarta. For a given
If this resolver handles the given (base, property) pair, the
This is not always the same as
If the resolver or the property is read-only, this method must return | |
| getValue | back to summary |
|---|---|
| public Object getValue(ELContext context, Object base, Object property) Implements abstract jakarta. Doc from jakarta. Attempts to resolve the given
If this resolver handles the given (base, property) pair, the
| |
| invoke | back to summary |
|---|---|
| public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) Overrides jakarta. Doc from jakarta. Attempts to resolve and invoke the given
If this resolver handles the given (base, method) pair, the A default implementation is provided that returns null so that existing classes that extend ELResolver can continue to function.
| |
| isReadOnly | back to summary |
|---|---|
| public boolean isReadOnly(ELContext context, Object base, Object property) Implements abstract jakarta. Doc from jakarta. For a given
If this resolver handles the given (base, property) pair, the | |
| setValue | back to summary |
|---|---|
| public void setValue(ELContext context, Object base, Object property, Object value) Implements abstract jakarta. Doc from jakarta. Attempts to set the value of the given
If this resolver handles the given (base, property) pair, the
If the base object is an | |