Package dev.cel.common.values
Class ProtoCelValueConverter
- java.lang.Object
-
- dev.cel.common.values.ProtoCelValueConverter
-
@Immutable @Internal public final class ProtoCelValueConverter extends java.lang.Object
CelValueConverter
handles bidirectional conversion between native Java and protobuf objects toCelValue
.Protobuf semantics take precedence for conversion. For example, CEL's TimestampValue will be converted into Protobuf's Timestamp instead of java.time.Instant.
CEL Library Internals. Do Not Use.
-
-
Field Summary
Fields Modifier and Type Field Description protected CelOptions
celOptions
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
fromCelValueToJavaObject(CelValue celValue)
Adapts aCelValue
to a native Java object.CelValue
fromJavaObjectToCelValue(java.lang.Object value)
Adapts a plain old Java Object to aCelValue
.protected CelValue
fromJavaPrimitiveToCelValue(java.lang.Object value)
Adapts a plain old Java Object that are considered primitives to aCelValue
.CelValue
fromProtoMessageFieldToCelValue(com.google.protobuf.Message message, com.google.protobuf.Descriptors.FieldDescriptor fieldDescriptor)
Adapts the protobuf message field intoCelValue
.CelValue
fromProtoMessageToCelValue(com.google.protobuf.MessageOrBuilder message)
Adapts a Protobuf message into aCelValue
.static ProtoCelValueConverter
newInstance(CelOptions celOptions, CelDescriptorPool celDescriptorPool, DynamicProto dynamicProto)
Constructs a new instance of ProtoCelValueConverter.
-
-
-
Field Detail
-
celOptions
protected final CelOptions celOptions
-
-
Method Detail
-
newInstance
public static ProtoCelValueConverter newInstance(CelOptions celOptions, CelDescriptorPool celDescriptorPool, DynamicProto dynamicProto)
Constructs a new instance of ProtoCelValueConverter.
-
fromCelValueToJavaObject
public java.lang.Object fromCelValueToJavaObject(CelValue celValue)
Adapts aCelValue
to a native Java object. The CelValue is adapted into protobuf object when an equivalent exists.
-
fromProtoMessageToCelValue
public CelValue fromProtoMessageToCelValue(com.google.protobuf.MessageOrBuilder message)
Adapts a Protobuf message into aCelValue
.
-
fromJavaObjectToCelValue
public CelValue fromJavaObjectToCelValue(java.lang.Object value)
Adapts a plain old Java Object to aCelValue
. Protobuf semantics take precedence for conversion.
-
fromProtoMessageFieldToCelValue
public CelValue fromProtoMessageFieldToCelValue(com.google.protobuf.Message message, com.google.protobuf.Descriptors.FieldDescriptor fieldDescriptor)
Adapts the protobuf message field intoCelValue
.
-
-