Package dev.cel.runtime
Class RuntimeTypeProviderLegacyImpl
- java.lang.Object
-
- dev.cel.runtime.RuntimeTypeProviderLegacyImpl
-
- All Implemented Interfaces:
MessageProvider,RuntimeTypeProvider,TypeResolver
@Internal @Immutable public final class RuntimeTypeProviderLegacyImpl extends java.lang.Object implements RuntimeTypeProvider
Bridge between the old RuntimeTypeProvider and CelValueProvider APIs.
-
-
Constructor Summary
Constructors Constructor Description RuntimeTypeProviderLegacyImpl(CelOptions celOptions, CelValueProvider valueProvider, CelDescriptorPool celDescriptorPool, DynamicProto dynamicProto)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectadapt(java.lang.Object message)Adapt object to its message value with source location metadata on failure .@Nullable ValueadaptType(@Nullable Type type)Adapt the check-timetypeinstance to a runtimeValue.ValueadaptType(CelType type)Adapt the check-timetypeinstance to a runtimeValue.java.lang.ObjectcreateMessage(java.lang.String messageName, java.util.Map<java.lang.String,java.lang.Object> values)Create a message based on the fully qualified message name and field-value mapping.java.lang.ObjecthasField(java.lang.Object message, java.lang.String fieldName)Check whether a field is set on message.ValueresolveObjectType(java.lang.Object obj, Value checkedTypeValue)Resolve the CEL type of theobj, using thecheckedTypeValueas hint for type disambiguation.java.lang.ObjectselectField(java.lang.Object message, java.lang.String fieldName)Select field from message.
-
-
-
Constructor Detail
-
RuntimeTypeProviderLegacyImpl
public RuntimeTypeProviderLegacyImpl(CelOptions celOptions, CelValueProvider valueProvider, CelDescriptorPool celDescriptorPool, DynamicProto dynamicProto)
-
-
Method Detail
-
createMessage
public java.lang.Object createMessage(java.lang.String messageName, java.util.Map<java.lang.String,java.lang.Object> values)Description copied from interface:MessageProviderCreate a message based on the fully qualified message name and field-value mapping.- Specified by:
createMessagein interfaceMessageProvider
-
selectField
public java.lang.Object selectField(java.lang.Object message, java.lang.String fieldName)Description copied from interface:MessageProviderSelect field from message.- Specified by:
selectFieldin interfaceMessageProvider
-
hasField
public java.lang.Object hasField(java.lang.Object message, java.lang.String fieldName)Description copied from interface:MessageProviderCheck whether a field is set on message.- Specified by:
hasFieldin interfaceMessageProvider
-
adapt
public java.lang.Object adapt(java.lang.Object message)
Description copied from interface:MessageProviderAdapt object to its message value with source location metadata on failure .- Specified by:
adaptin interfaceMessageProvider
-
resolveObjectType
public Value resolveObjectType(java.lang.Object obj, Value checkedTypeValue)
Description copied from interface:TypeResolverResolve the CEL type of theobj, using thecheckedTypeValueas hint for type disambiguation.The
checkedTypeValueindicates the statically determined type of the object at check-time. Often, the check-time and runtime phases agree, but there are cases where the runtime type is ambiguous, as is the case when aLongvalue is supplied as this could either be an int, uint, or enum type.Type resolution is biased toward the runtime value type, given the dynamically typed nature of CEL.
- Specified by:
resolveObjectTypein interfaceTypeResolver
-
adaptType
public Value adaptType(CelType type)
Description copied from interface:TypeResolverAdapt the check-timetypeinstance to a runtimeValue.When the checked
typedoes not have a runtime equivalent, e.g.Type#DYN, the return value will benull.- Specified by:
adaptTypein interfaceTypeResolver
-
adaptType
public @Nullable Value adaptType(@Nullable Type type)
Description copied from interface:TypeResolverAdapt the check-timetypeinstance to a runtimeValue.When the checked
typedoes not have a runtime equivalent, e.g.Type#DYN, the return value will benull.- Specified by:
adaptTypein interfaceTypeResolver
-
-