Class Activation

  • All Implemented Interfaces:
    GlobalResolver

    @Internal
    public abstract class Activation
    extends java.lang.Object
    implements GlobalResolver
    An object which allows to bind names to values.

    CEL Library Internals. Do Not Use.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Activation EMPTY
      An empty binder which resolves everything to null.
    • Constructor Summary

      Constructors 
      Constructor Description
      Activation()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static Activation copyOf​(java.util.Map<java.lang.String,​?> map)
      Creates a binder backed up by a map.
      Activation extend​(Activation activation)
      Extends this binder by another binder.
      static Activation fromProto​(Message message)
      Creates an Activation from a Message where each field in the message is exposed as a top-level variable in the Activation.
      static Activation fromProto​(Message message, CelOptions celOptions)
      Creates an Activation from a Message where each field in the message is exposed as a top-level variable in the Activation.
      static Activation of​(java.lang.String name, com.google.common.base.Supplier<?> supplier)
      Creates a binder which binds the given name to the supplier.
      static Activation of​(java.lang.String name, java.lang.Object value)
      Creates a binder which binds the given name to the value.
      abstract @Nullable java.lang.Object resolve​(java.lang.String name)
      Resolves the given name to its value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY

        public static final Activation EMPTY
        An empty binder which resolves everything to null.
    • Constructor Detail

      • Activation

        public Activation()
    • Method Detail

      • resolve

        public abstract @Nullable java.lang.Object resolve​(java.lang.String name)
        Resolves the given name to its value. Returns null if resolution fails.
        Specified by:
        resolve in interface GlobalResolver
      • of

        public static Activation of​(java.lang.String name,
                                    java.lang.Object value)
        Creates a binder which binds the given name to the value.
      • of

        public static Activation of​(java.lang.String name,
                                    com.google.common.base.Supplier<?> supplier)
        Creates a binder which binds the given name to the supplier.
      • copyOf

        public static Activation copyOf​(java.util.Map<java.lang.String,​?> map)
        Creates a binder backed up by a map.
      • fromProto

        public static Activation fromProto​(Message message)
        Creates an Activation from a Message where each field in the message is exposed as a top-level variable in the Activation.

        Unset message fields are published with the default value for the field type. However, an unset google.protobuf.Any value is not a valid CEL value, and will be published as an Exception value on the Activation just as though an unset Any would if it were accessed during a CEL evaluation.

        Note, this call does not support unsigned integer fields properly and encodes them as long values. If ExprFeatures.ENABLE_UNSIGNED_LONGS is in use, use fromProto(Message, CelOptions) to ensure that the message fields are properly designated as UnsignedLong values.

      • fromProto

        public static Activation fromProto​(Message message,
                                           CelOptions celOptions)
        Creates an Activation from a Message where each field in the message is exposed as a top-level variable in the Activation.

        Unset message fields are published with the default value for the field type. However, an unset google.protobuf.Any value is not a valid CEL value, and will be published as an Exception value on the Activation just as though an unset Any would if it were accessed during a CEL evaluation.

      • extend

        public Activation extend​(Activation activation)
        Extends this binder by another binder. Names will be attempted to first resolve in the other binder, then in this binder.