Class DefaultInstanceMessageFactory


  • @Internal
    public final class DefaultInstanceMessageFactory
    extends java.lang.Object
    Singleton factory for creating default messages from a protobuf descriptor.

    CEL Library Internals. Do Not Use.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static DefaultInstanceMessageFactory getInstance()
      Gets a single instance of this MessageFactory
      java.util.Optional<com.google.protobuf.Message> getPrototype​(com.google.protobuf.Descriptors.Descriptor descriptor)
      Creates a default instance of a protobuf message given a descriptor.
      • Methods inherited from class java.lang.Object

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

      • getPrototype

        public java.util.Optional<com.google.protobuf.Message> getPrototype​(com.google.protobuf.Descriptors.Descriptor descriptor)
        Creates a default instance of a protobuf message given a descriptor. This is essentially the same as calling FooMessage.getDefaultInstance(), except reflection is leveraged.
        Returns:
        Default instance of a type. Returns an empty optional if the descriptor used to construct the type via reflection is different to the provided descriptor or if the descriptor class isn't loaded in the binary.