# Class RecordELResolver

java.lang.Object
jakarta.el.ELResolver
jakarta.el.RecordELResolver

public class RecordELResolver extends ELResolver
Defines property resolution behavior on instances of `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 using `CompositeELResolver`s to define rich semantics for evaluating an expression. See the javadocs for `ELResolver` for details.

Since:
  EL 6.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RecordELResolver()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Class<?>`
  `getCommonPropertyType(ELContext context, Object base)`
  If the base object is an instance of `Record`, returns the most general type this resolver accepts for the `property` argument.
  `Class<?>`
  `getType(ELContext context, Object base, Object property)`
  If the base object is an instance of `Record`, always returns `null` since `Record`s are always read-only.
  `Object`
  `getValue(ELContext context, Object base, Object property)`
  If the base object is an instance of `Record`, returns the value of the given field of this `Record`.
  `boolean`
  `isReadOnly(ELContext context, Object base, Object property)`
  If the base object is an instance of `Record`, always returns `true`.
  `void`
  `setValue(ELContext context, Object base, Object property, Object value)`
  If the base object is an instance of `Record`, always throws an exception since `Record`s are read-only.

  ### Methods inherited from class jakarta.el.ELResolver

  `convertToType, invoke`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RecordELResolver

    public RecordELResolver()

- ## Method Details

  - ### getValue

    public Object getValue(ELContext context, Object base, Object property)
    If the base object is an instance of `Record`, returns the value of the given field of this `Record`.

    If the base object is an instance of `Record`, the `propertyResolved` property of the provided `ELContext` must be set to `true` by this resolver before returning. If this property is not `true` after this method is called, the caller should ignore the return value.

    Specified by:
      `getValue` in class `ELResolver`
    Parameters:
      `context` - The context of this evaluation.
      `base` - The `Record` on which to get the property.
      `property` - The property to get. Will be coerced to a String.
    Returns:
      If the `propertyResolved` property of the provided `ELContext` was set to `true` then the value of the given property. Otherwise, undefined.
    Throws:
      `NullPointerException` - if the provided `ELContext` is `null`.
      `PropertyNotFoundException` - if the `base` is an instance of `Record` and 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

    public Class<?> getType(ELContext context, Object base, Object property)
    If the base object is an instance of `Record`, always returns `null` since `Record`s are always read-only.

    If the base object is an instance of `Record`, the `propertyResolved` property of the provided `ELContext` must be set to `true` by this resolver before returning. If this property is not `true` after this method is called, the caller should ignore the return value.

    Specified by:
      `getType` in class `ELResolver`
    Parameters:
      `context` - The context of this evaluation.
      `base` - The `Record` to analyze.
      `property` - The name of the property to analyze. Will be coerced to a String.
    Returns:
      Always `null`
    Throws:
      `NullPointerException` - if the provided `ELContext` is `null`.
      `PropertyNotFoundException` - if the `base` is an instance of `Record` and the specified property does not exist.

  - ### setValue

    public void setValue(ELContext context, Object base, Object property, Object value)
    If the base object is an instance of `Record`, always throws an exception since `Record`s are read-only.

    If the base object is an instance of `Record`, the `propertyResolved` property of the provided `ELContext` must be set to `true` by this resolver before returning. If this property is not `true` after this method is called, the caller should ignore the return value.

    Specified by:
      `setValue` in class `ELResolver`
    Parameters:
      `context` - The context of this evaluation.
      `base` - The `Record` 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 to
    Throws:
      `NullPointerException` - if the provided `ELContext` is `null`.
      `PropertyNotFoundException` - if the `base` is an instance of `Record` and the specified property does not exist.
      `PropertyNotWritableException` - if the `base` is an instance of `Record` and the specified property exists.

  - ### isReadOnly

    public boolean isReadOnly(ELContext context, Object base, Object property)
    If the base object is an instance of `Record`, always returns `true`.

    If the base object is an instance of `Record`, the `propertyResolved` property of the provided `ELContext` must be set to `true` by this resolver before returning. If this property is not `true` after this method is called, the caller should ignore the return value.

    Specified by:
      `isReadOnly` in class `ELResolver`
    Parameters:
      `context` - The context of this evaluation.
      `base` - The `Record` to analyze.
      `property` - The name of the property to analyze. Will be coerced to a String.
    Returns:
      `true` if the identified property is read only, otherwise `false`
    Throws:
      `NullPointerException` - if the provided `ELContext` is `null`.
      `PropertyNotFoundException` - if the `base` is an instance of `Record` and the specified property does not exist.

  - ### getCommonPropertyType

    public Class<?> getCommonPropertyType(ELContext context, Object base)
    If the base object is an instance of `Record`, returns the most general type this resolver accepts for the `property` argument. Otherwise, returns `null`.

    If the base object is an instance of `Record` this method will always return `Object` since any object is accepted for the property argument and coerced to a String.

    Specified by:
      `getCommonPropertyType` in class `ELResolver`
    Parameters:
      `context` - The context of this evaluation.
      `base` - The `Record` to analyze.
    Returns:
      `Object` is base is an instance of `Record`, otherwise `null`.