Class StructValue<F,​V>

  • Type Parameters:
    F - The type of the field identifier. Only String is supported for now, but we may extend support to other types in the future.
    V - The type of the wrapped native object.
    All Implemented Interfaces:
    SelectableValue<F>

    @Immutable
    public abstract class StructValue<F,​V>
    extends CelValue
    implements SelectableValue<F>
    StructValue is a representation of a structured object with typed properties.

    Users may extend from this class to provide a custom struct that CEL can understand by wrapping a native Java object (e.g., a POJO or a Map). Custom struct implementations must provide all functionalities denoted in the CEL specification, such as field selection, presence testing and new object creation.

    For an expression `e` selecting a field `f`, `e.f` must throw an exception if `f` does not exist in the struct (i.e: hasField returns false). If the field exists but is not set, the implementation should return an appropriate default value based on the struct's semantics.

    • Constructor Summary

      Constructors 
      Constructor Description
      StructValue()  
    • Constructor Detail

      • StructValue

        public StructValue()
    • Method Detail

      • value

        public abstract V value()
        Description copied from class: CelValue
        The underlying value. This is typically the Java native value or a derived instance of CelValue (ex: an element in lists or key/value pair in maps).
        Specified by:
        value in class CelValue