Package dev.cel.common.internal
Class DynamicProto
- java.lang.Object
-
- dev.cel.common.internal.DynamicProto
-
@Immutable @CheckReturnValue @Internal public final class DynamicProto extends java.lang.ObjectTheDynamicProtoclass supports the conversion ofAnyvalues to concreteMessagetypes based on provided descriptors.CEL Library Internals. Do Not Use.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DynamicProtocreate(ProtoMessageFactory protoMessageFactory)ProtoMessageFactorygetProtoMessageFactory()Gets the underlying message factory used to construct new protobuf messages upon unpacking an Any message.com.google.protobuf.MessagemaybeAdaptDynamicMessage(com.google.protobuf.DynamicMessage input)This method will attempt to adapt aDynamicMessageinstance to a generatedMessageinstance if possible.java.util.Optional<com.google.protobuf.Message>maybeUnpackAny(com.google.protobuf.Message msg)Attempts to unpack an Any message.com.google.protobuf.Messageunpack(com.google.protobuf.Any any)Unpack anAnyvalue to a concreteMessagevalue.
-
-
-
Method Detail
-
create
public static DynamicProto create(ProtoMessageFactory protoMessageFactory)
-
getProtoMessageFactory
public ProtoMessageFactory getProtoMessageFactory()
Gets the underlying message factory used to construct new protobuf messages upon unpacking an Any message.
-
maybeUnpackAny
public java.util.Optional<com.google.protobuf.Message> maybeUnpackAny(com.google.protobuf.Message msg)
Attempts to unpack an Any message.
-
unpack
public com.google.protobuf.Message unpack(com.google.protobuf.Any any) throws com.google.protobuf.InvalidProtocolBufferExceptionUnpack anAnyvalue to a concreteMessagevalue.For protobuf types which have been linked into the binary, the method will return an instance of a derived
Messagetype. However, for messages unpacked from the configured descriptors, the result will be aDynamicMessageinstance.- Throws:
com.google.protobuf.InvalidProtocolBufferException
-
maybeAdaptDynamicMessage
public com.google.protobuf.Message maybeAdaptDynamicMessage(com.google.protobuf.DynamicMessage input)
This method will attempt to adapt aDynamicMessageinstance to a generatedMessageinstance if possible. This scenario can occur during field selection on a higher level dynamic message whose type isn't linked in the binary, but the field's type is.
-
-