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 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 ofRecordand a no-arg method exists with the name of the property, returnstrue.voidMethods inherited from class ELResolver
convertToType, invoke
-
Constructor Details
-
RecordELResolver
public RecordELResolver()Constructs a new instance of the resolver.
-
-
Method Details
-
getValue
If the base object is an instance ofRecordand a no-arg method exists with the name of the property, returns the value of the given property of thisRecord.If the base object is an instance of
Recordand no-arg method exists with the name of the property, 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.The
Recordmay include properties using JavaBean naming conventions for which no-arg methods do not exist. Such properties will not be discovered by this resolver. In typical usage, such properties would be resolved by the next resolver in the chain, theBeanELResolver.- 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.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 ofRecordand a no-arg method exists with the name of the property, returnsnullsinceRecords are always read-only.If the base object is an instance of
Recordand no-arg method exists with the name of the property, 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.The
Recordmay include properties using JavaBean naming conventions for which no-arg methods do not exist. Such properties will not be discovered by this resolver. In typical usage, such properties would be resolved by the next resolver in the chain, theBeanELResolver.- 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.
-
setValue
If the base object is an instance ofRecordand a no-arg method exists with the name of the property, throws an exception sinceRecords are read-only.If the base object is an instance of
Recordand no-arg method exists with the name of the property, 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.The
Recordmay include properties using JavaBean naming conventions for which no-arg methods do not exist. Such properties will not be discovered by this resolver. In typical usage, such properties would be resolved by the next resolver in the chain, theBeanELResolver.- 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.PropertyNotWritableException- if thebaseis an instance ofRecordand the specified property exists.
-
isReadOnly
If the base object is an instance ofRecordand a no-arg method exists with the name of the property, returnstrue.If the base object is an instance of
Recordand no-arg method exists with the name of the property, 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.The
Recordmay include properties using JavaBean naming conventions for which no-arg methods do not exist. Such properties will not be discovered by this resolver. In typical usage, such properties would be resolved by the next resolver in the chain, theBeanELResolver.- 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.
-
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.
-