Class TypeRegistry.Builder

  • Enclosing class:
    TypeRegistry

    public static final class TypeRegistry.Builder
    extends java.lang.Object
    A Builder is used to build TypeRegistry.
    • Method Detail

      • add

        @CanIgnoreReturnValue
        public TypeRegistry.Builder add​(Descriptors.Descriptor messageType)
        Adds a message type and all types defined in the same .proto file as well as all transitively imported .proto files to this TypeRegistry.Builder.

        Note: In the case of adding duplicate types, the first one added will be used and subsequent ones will be ignored. Especially if you are dynamically loading FileDesciptors which may redefine the same fully qualified names, you may want to create a layer on top to control your intended behavior in the face of duplicates.

      • add

        @CanIgnoreReturnValue
        public TypeRegistry.Builder add​(java.lang.Iterable<Descriptors.Descriptor> messageTypes)
        Adds message types and all types defined in the same .proto file as well as all transitively imported .proto files to this TypeRegistry.Builder.

        Note: In the case of adding duplicate types, the first one added will be used and subsequent ones will be ignored. Especially if you are dynamically loading FileDesciptors which may redefine the same fully qualified names, you may want to create a layer on top to control your intended behavior in the face of duplicates.