com.google.protobuf

## Class GeneratedMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>

- java.lang.Object
- - com.google.protobuf.AbstractMessageLite.Builder<MessageType,BuilderType>
  - - com.google.protobuf.GeneratedMessageLite.Builder<MessageType,BuilderType>

- All Implemented Interfaces:
    MessageLite.Builder, MessageLiteOrBuilder, java.lang.Cloneable
  Direct Known Subclasses:
    GeneratedMessageLite.ExtendableBuilder
  Enclosing class:
    GeneratedMessageLite<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>

      public abstract static class GeneratedMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>
      extends AbstractMessageLite.Builder<MessageType,BuilderType>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected MessageType` | `instance`
    `protected boolean` | `isBuilt`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `GeneratedMessageLite.Builder(MessageType defaultInstance)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MessageType` | `build()` Constructs the message based on the state of the Builder.
    `MessageType` | `buildPartial()` Like `MessageLite.Builder.build()`, but does not throw an exception if the message is missing required fields.
    `BuilderType` | `clear()` Resets all fields to their default values.
    `BuilderType` | `clone()` Clones the Builder.
    `protected void` | `copyOnWrite()` Called before any method that would mutate the builder to ensure that it correctly copies any state before the write happens to preserve immutability guarantees.
    `MessageType` | `getDefaultInstanceForType()` Get an instance of the type with no fields set.
    `protected BuilderType` | `internalMergeFrom(MessageType message)`
    `boolean` | `isInitialized()` Returns true if all required fields in the message and all embedded messages are set, false otherwise.
    `BuilderType` | `mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)` Like `MessageLite.Builder.mergeFrom(CodedInputStream)`, but also parses extensions.
    `BuilderType` | `mergeFrom(MessageType message)` All subclasses implement this.

    - ### Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder

      `addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### instance

          protected MessageType extends GeneratedMessageLite<MessageType,BuilderType> instance

    - #### isBuilt

          protected boolean isBuilt

  - ### Constructor Detail

    - #### GeneratedMessageLite.Builder

          protected GeneratedMessageLite.Builder(MessageType defaultInstance)

  - ### Method Detail

    - #### copyOnWrite

          protected void copyOnWrite()

      Called before any method that would mutate the builder to ensure that it correctly copies any state before the write happens to preserve immutability guarantees.

    - #### isInitialized

          public final boolean isInitialized()

      Description copied from interface: `MessageLiteOrBuilder`
      Returns true if all required fields in the message and all embedded messages are set, false otherwise.

      See also: `MessageOrBuilder.getInitializationErrorString()`

    - #### clear

          public final BuilderType clear()

      Description copied from interface: `MessageLite.Builder`
      Resets all fields to their default values.

    - #### clone

          public BuilderType clone()

      Description copied from interface: `MessageLite.Builder`
      Clones the Builder.
      Specified by:
        `clone` in interface `MessageLite.Builder`
      Specified by:
        `clone` in class `AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>`
      See Also:
        `Object.clone()`

    - #### buildPartial

          public MessageType buildPartial()

      Description copied from interface: `MessageLite.Builder`
      Like `MessageLite.Builder.build()`, but does not throw an exception if the message is missing required fields. Instead, a partial message is returned. Subsequent changes to the Builder will not affect the returned message.

    - #### build

          public final MessageType build()

      Description copied from interface: `MessageLite.Builder`
      Constructs the message based on the state of the Builder. Subsequent changes to the Builder will not affect the returned message.

    - #### internalMergeFrom

          protected BuilderType internalMergeFrom(MessageType message)

      Specified by:
        `internalMergeFrom` in class `AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>`

    - #### mergeFrom

          public BuilderType mergeFrom(MessageType message)

      All subclasses implement this.

    - #### getDefaultInstanceForType

          public MessageType getDefaultInstanceForType()

      Description copied from interface: `MessageLiteOrBuilder`
      Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from the `getDefaultInstance()` method of generated message classes in that this method is an abstract method of the `MessageLite` interface whereas `getDefaultInstance()` is a static method of a specific class. They return the same thing.

    - #### mergeFrom

          public BuilderType mergeFrom(CodedInputStream input,
                              ExtensionRegistryLite extensionRegistry)
                                                                                              throws java.io.IOException

      Description copied from interface: `MessageLite.Builder`
      Like `MessageLite.Builder.mergeFrom(CodedInputStream)`, but also parses extensions. The extensions that you want to be able to parse must be registered in `extensionRegistry`. Extensions not in the registry will be treated as unknown fields.
      Specified by:
        `mergeFrom` in interface `MessageLite.Builder`
      Specified by:
        `mergeFrom` in class `AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>`
      Throws:
        `java.io.IOException`