Class DynamicProto


  • @Immutable
    @CheckReturnValue
    @Internal
    public final class DynamicProto
    extends java.lang.Object
    The DynamicProto class supports the conversion of Any values to concrete Message types 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 DynamicProto create​(ProtoMessageFactory protoMessageFactory)  
      ProtoMessageFactory getProtoMessageFactory()
      Gets the underlying message factory used to construct new protobuf messages upon unpacking an Any message.
      com.google.protobuf.Message maybeAdaptDynamicMessage​(com.google.protobuf.DynamicMessage input)
      This method will attempt to adapt a DynamicMessage instance to a generated Message instance if possible.
      java.util.Optional<com.google.protobuf.Message> maybeUnpackAny​(com.google.protobuf.Message msg)
      Attempts to unpack an Any message.
      com.google.protobuf.Message unpack​(com.google.protobuf.Any any)
      Unpack an Any value to a concrete Message value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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.InvalidProtocolBufferException
        Unpack an Any value to a concrete Message value.

        For protobuf types which have been linked into the binary, the method will return an instance of a derived Message type. However, for messages unpacked from the configured descriptors, the result will be a DynamicMessage instance.

        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • maybeAdaptDynamicMessage

        public com.google.protobuf.Message maybeAdaptDynamicMessage​(com.google.protobuf.DynamicMessage input)
        This method will attempt to adapt a DynamicMessage instance to a generated Message instance 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.