Record
.
The resolver handles base objects of type Record
. It accepts any non-null
object as a property and
coerces it to a String using Object.toString()
. The property string is used to find an accessor method for a
field with the same name.
This resolver is always read-only since Record
s are always read-only.
ELResolver
s are combined together using CompositeELResolver
s to define rich semantics for evaluating
an expression. See the javadocs for ELResolver
for details.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionClass
<?> getCommonPropertyType
(ELContext context, Object base) If the base object is an instance ofRecord
, returns the most general type this resolver accepts for theproperty
argument.Class
<?> boolean
isReadOnly
(ELContext context, Object base, Object property) If the base object is an instance ofRecord
, always returnstrue
.void
Methods inherited from class jakarta.el.ELResolver
convertToType, invoke
-
Constructor Details
-
RecordELResolver
public RecordELResolver()
-
-
Method Details
-
getValue
If the base object is an instance ofRecord
, returns the value of the given field of thisRecord
.If the base object is an instance of
Record
, thepropertyResolved
property of the providedELContext
must be set totrue
by this resolver before returning. If this property is nottrue
after this method is called, the caller should ignore the return value.- Specified by:
getValue
in classELResolver
- Parameters:
context
- The context of this evaluation.base
- TheRecord
on which to get the property.property
- The property to get. Will be coerced to a String.- Returns:
- If the
propertyResolved
property of the providedELContext
was set totrue
then the value of the given property. Otherwise, undefined. - Throws:
NullPointerException
- if the providedELContext
isnull
.PropertyNotFoundException
- if thebase
is an instance ofRecord
and the specified property does not exist.ELException
- if an exception was thrown while performing the property resolution. The thrown exception must be included as the cause of this exception, if available.
-
getType
If the base object is an instance ofRecord
, always returnsnull
sinceRecord
s are always read-only.If the base object is an instance of
Record
, thepropertyResolved
property of the providedELContext
must be set totrue
by this resolver before returning. If this property is nottrue
after this method is called, the caller should ignore the return value.- Specified by:
getType
in classELResolver
- Parameters:
context
- The context of this evaluation.base
- TheRecord
to analyze.property
- The name of the property to analyze. Will be coerced to a String.- Returns:
- Always
null
- Throws:
NullPointerException
- if the providedELContext
isnull
.PropertyNotFoundException
- if thebase
is an instance ofRecord
and the specified property does not exist.
-
setValue
If the base object is an instance ofRecord
, always throws an exception sinceRecord
s are read-only.If the base object is an instance of
Record
, thepropertyResolved
property of the providedELContext
must be set totrue
by this resolver before returning. If this property is nottrue
after this method is called, the caller should ignore the return value.- Specified by:
setValue
in classELResolver
- Parameters:
context
- The context of this evaluation.base
- TheRecord
on which to set the property.property
- The name of the property to set. Will be coerced to a String.value
- The value to set the property or variable to.- Throws:
NullPointerException
- if the providedELContext
isnull
.PropertyNotFoundException
- if thebase
is an instance ofRecord
and the specified property does not exist.PropertyNotWritableException
- if thebase
is an instance ofRecord
and the specified property exists.
-
isReadOnly
If the base object is an instance ofRecord
, always returnstrue
.If the base object is an instance of
Record
, thepropertyResolved
property of the providedELContext
must be set totrue
by this resolver before returning. If this property is nottrue
after this method is called, the caller should ignore the return value.- Specified by:
isReadOnly
in classELResolver
- Parameters:
context
- The context of this evaluation.base
- TheRecord
to analyze.property
- The name of the property to analyze. Will be coerced to a String.- Returns:
- If the
propertyResolved
property ofELContext
was set totrue
, thentrue
if the property is read-only orfalse
if not; otherwise undefined. - Throws:
NullPointerException
- if the providedELContext
isnull
.PropertyNotFoundException
- if thebase
is an instance ofRecord
and the specified property does not exist.
-
getCommonPropertyType
If the base object is an instance ofRecord
, returns the most general type this resolver accepts for theproperty
argument. Otherwise, returnsnull
.If the base object is an instance of
Record
this method will always returnObject
since any object is accepted for the property argument and coerced to a String.- Specified by:
getCommonPropertyType
in classELResolver
- Parameters:
context
- The context of this evaluation.base
- TheRecord
to analyze.- Returns:
Object
is base is an instance ofRecord
, otherwisenull
.
-