Package 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`, `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
Description
`protected MessageType`
`instance`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`Builder(MessageType defaultInstance)`

## Method Summary

Modifier and Type
Method
Description
`final 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.
`final BuilderType`
`clear()`
Resets all fields to their default values.
`BuilderType`
`clone()`
Clones the Builder.
`protected final 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.
`protected void`
`copyOnWriteInternal()`
`MessageType`
`getDefaultInstanceForType()`
Get an instance of the type with no fields set.
`protected BuilderType`
`internalMergeFrom(MessageType message)`
`final boolean`
`isInitialized()`
Returns true if all required fields in the message and all embedded messages are set, false otherwise.
`BuilderType`
`mergeFrom(byte[] input, int offset, int length)`
Parse `data` as a message of this type and merge it with the message being built.
`BuilderType`
`mergeFrom(byte[] input, int offset, int length, ExtensionRegistryLite extensionRegistry)`
Parse `data` as a message of this type and merge it with the message being built.
`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, addAll, mergeDelimitedFrom, mergeDelimitedFrom, 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 Details

### instance

protected MessageType extends GeneratedMessageLite<MessageType,BuilderType> instance

## Constructor Details

### Builder

protected Builder(MessageType defaultInstance)

## Method Details

### copyOnWrite

protected final 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.

### copyOnWriteInternal

protected void copyOnWriteInternal()

### 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(byte[] input, int offset, int length, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
Description copied from interface: `MessageLite.Builder`
Parse `data` as a message of this type and merge it with the message being built. This is just a small wrapper around `MessageLite.Builder.mergeFrom(CodedInputStream,ExtensionRegistryLite)`.

Specified by:
  `mergeFrom` in interface `MessageLite.Builder`
Overrides:
  `mergeFrom` in class `AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>`
Returns:
  this
Throws:
  `InvalidProtocolBufferException` - the bytes in data are not syntactically correct according to the protobuf wire format specification. The data is corrupt, incomplete, or was never a protobuf in the first place.

### mergeFrom

public BuilderType mergeFrom(byte[] input, int offset, int length) throws InvalidProtocolBufferException
Description copied from interface: `MessageLite.Builder`
Parse `data` as a message of this type and merge it with the message being built. This is just a small wrapper around `MessageLite.Builder.mergeFrom(CodedInputStream)`.

Specified by:
  `mergeFrom` in interface `MessageLite.Builder`
Overrides:
  `mergeFrom` in class `AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>`
Returns:
  this
Throws:
  `InvalidProtocolBufferException` - the bytes in data are not syntactically correct according to the protobuf wire format specification. The data is corrupt, incomplete, or was never a protobuf in the first place.

### mergeFrom

public BuilderType mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws 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:
  `IOException` - an I/O error reading from the stream