Package jakarta.el

Class OptionalELResolver

java.lang.Object
jakarta.el.ELResolver
jakarta.el.OptionalELResolver

public class OptionalELResolver extends ELResolver
Defines property resolution behaviour on Optionals.

This resolver handles base objects that are instances of Optional.

If the Optional.isEmpty() is true for the base object and the property is null then the resulting value is null.

If the Optional.isEmpty() is true for the base object and the property is not null then the resulting value is the base object (an empty Optional).

If the Optional.isPresent() is true for the base object and the property is null then the resulting value is the result of calling Optional.get() on the base object.

If the Optional.isPresent() is true for the base object and the property is not null then the resulting value is the result of calling ELResolver.getValue(ELContext, Object, Object) using the ELResolver obtained from ELContext.getELResolver() with the following parameters:

  • The ELContext is the current context
  • The base object is the result of calling Optional.get() on the current base object
  • The property object is the current property object

This resolver is always a read-only resolver.