Class RecordELResolver
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 Records are always read-only.
ELResolvers are combined together using CompositeELResolvers to define rich semantics for evaluating
an expression. See the javadocs for ELResolver for details.
- Since:
- EL 6.0
-
Constructor Summary
Constructors -
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 thepropertyargument.Class<?> booleanisReadOnly(ELContext context, Object base, Object property) If the base object is an instance ofRecord, always returnstrue.voidMethods 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, thepropertyResolvedproperty of the providedELContextmust be set totrueby this resolver before returning. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
getValuein classELResolver- Parameters:
context- The context of this evaluation.base- TheRecordon which to get the property.property- The property to get. Will be coerced to a String.- Returns:
- If the
propertyResolvedproperty of the providedELContextwas set totruethen the value of the given property. Otherwise, undefined. - Throws:
NullPointerException- if the providedELContextisnull.PropertyNotFoundException- if thebaseis an instance ofRecordand the specified property does not exist.ELException- if an exception was throws 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 returnsnullsinceRecords are always read-only.If the base object is an instance of
Record, thepropertyResolvedproperty of the providedELContextmust be set totrueby this resolver before returning. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
getTypein classELResolver- Parameters:
context- The context of this evaluation.base- TheRecordto analyze.property- The name of the property to analyze. Will be coerced to a String.- Returns:
- Always
null - Throws:
NullPointerException- if the providedELContextisnull.PropertyNotFoundException- if thebaseis an instance ofRecordand the specified property does not exist.
-
setValue
If the base object is an instance ofRecord, always throws an exception sinceRecords are read-only.If the base object is an instance of
Record, thepropertyResolvedproperty of the providedELContextmust be set totrueby this resolver before returning. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
setValuein classELResolver- Parameters:
context- The context of this evaluation.base- TheRecordon 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 to- Throws:
NullPointerException- if the providedELContextisnull.PropertyNotFoundException- if thebaseis an instance ofRecordand the specified property does not exist.PropertyNotWritableException- if thebaseis an instance ofRecordand the specified property exists.
-
isReadOnly
If the base object is an instance ofRecord, always returnstrue.If the base object is an instance of
Record, thepropertyResolvedproperty of the providedELContextmust be set totrueby this resolver before returning. If this property is nottrueafter this method is called, the caller should ignore the return value.- Specified by:
isReadOnlyin classELResolver- Parameters:
context- The context of this evaluation.base- TheRecordto analyze.property- The name of the property to analyze. Will be coerced to a String.- Returns:
trueif the identified property is read only, otherwisefalse- Throws:
NullPointerException- if the providedELContextisnull.PropertyNotFoundException- if thebaseis an instance ofRecordand the specified property does not exist.
-
getCommonPropertyType
If the base object is an instance ofRecord, returns the most general type this resolver accepts for thepropertyargument. Otherwise, returnsnull.If the base object is an instance of
Recordthis method will always returnObjectsince any object is accepted for the property argument and coerced to a String.- Specified by:
getCommonPropertyTypein classELResolver- Parameters:
context- The context of this evaluation.base- TheRecordto analyze.- Returns:
Objectis base is an instance ofRecord, otherwisenull.
-