Class Activation
- java.lang.Object
-
- dev.cel.runtime.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 ActivationEMPTYAn 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 ActivationcopyOf(java.util.Map<java.lang.String,?> map)Creates a binder backed up by a map.Activationextend(Activation activation)Extends this binder by another binder.static ActivationfromProto(Message message)Creates anActivationfrom aMessagewhere each field in the message is exposed as a top-level variable in theActivation.static ActivationfromProto(Message message, CelOptions celOptions)Creates anActivationfrom aMessagewhere each field in the message is exposed as a top-level variable in theActivation.static Activationof(java.lang.String name, com.google.common.base.Supplier<?> supplier)Creates a binder which binds the given name to the supplier.static Activationof(java.lang.String name, java.lang.Object value)Creates a binder which binds the given name to the value.abstract @Nullable java.lang.Objectresolve(java.lang.String name)Resolves the given name to its value.
-
-
-
Field Detail
-
EMPTY
public static final Activation EMPTY
An empty binder which resolves everything to null.
-
-
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:
resolvein interfaceGlobalResolver
-
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 anActivationfrom aMessagewhere each field in the message is exposed as a top-level variable in theActivation.Unset message fields are published with the default value for the field type. However, an unset
google.protobuf.Anyvalue is not a valid CEL value, and will be published as anExceptionvalue on theActivationjust as though an unsetAnywould 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_LONGSis in use, usefromProto(Message, CelOptions)to ensure that the message fields are properly designated asUnsignedLongvalues.
-
fromProto
public static Activation fromProto(Message message, CelOptions celOptions)
Creates anActivationfrom aMessagewhere each field in the message is exposed as a top-level variable in theActivation.Unset message fields are published with the default value for the field type. However, an unset
google.protobuf.Anyvalue is not a valid CEL value, and will be published as anExceptionvalue on theActivationjust as though an unsetAnywould 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.
-
-