public abstract static class GeneratedMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>> extends AbstractMessageLite.Builder<MessageType,BuilderType>
Modifier and Type | Field and Description |
---|---|
protected MessageType |
instance |
Modifier | Constructor and Description |
---|---|
protected |
Builder(MessageType defaultInstance) |
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.
|
protected void |
copyOnWriteInternal() |
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(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.
|
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException
protected MessageType extends GeneratedMessageLite<MessageType,BuilderType> instance
protected Builder(MessageType defaultInstance)
protected final void copyOnWrite()
protected void copyOnWriteInternal()
public final boolean isInitialized()
MessageLiteOrBuilder
public final BuilderType clear()
MessageLite.Builder
public BuilderType clone()
MessageLite.Builder
clone
in interface MessageLite.Builder
clone
in class AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>
Object.clone()
public MessageType buildPartial()
MessageLite.Builder
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.public final MessageType build()
MessageLite.Builder
protected BuilderType internalMergeFrom(MessageType message)
internalMergeFrom
in class AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>
public BuilderType mergeFrom(MessageType message)
public MessageType getDefaultInstanceForType()
MessageLiteOrBuilder
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.public BuilderType mergeFrom(byte[] input, int offset, int length, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
MessageLite.Builder
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)
.mergeFrom
in interface MessageLite.Builder
mergeFrom
in class AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>
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.public BuilderType mergeFrom(byte[] input, int offset, int length) throws InvalidProtocolBufferException
MessageLite.Builder
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)
.mergeFrom
in interface MessageLite.Builder
mergeFrom
in class AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>
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.public BuilderType mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
MessageLite.Builder
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.mergeFrom
in interface MessageLite.Builder
mergeFrom
in class AbstractMessageLite.Builder<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>>
InvalidProtocolBufferException
- the bytes read 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.IOException
- an I/O error reading from the streamCopyright © 2008–2022. All rights reserved.