Package dev.cel.common.internal
Class DynamicProto
- java.lang.Object
-
- dev.cel.common.internal.DynamicProto
-
-
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.MessagemaybeAdaptDynamicMessage(DynamicMessage input)This method will attempt to adapt aDynamicMessageinstance to a generatedMessageinstance if possible.java.util.Optional<Message>maybeUnpackAny(Message msg)Attempts to unpack an Any message.Messageunpack(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<Message> maybeUnpackAny(Message msg)
Attempts to unpack an Any message.
-
unpack
public Message unpack(Any any) throws InvalidProtocolBufferException
Unpack 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:
InvalidProtocolBufferException
-
maybeAdaptDynamicMessage
public Message maybeAdaptDynamicMessage(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.
-
-