|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface Message.Builder
Abstract interface implemented by Protocol Message builders.
Method Summary | |
---|---|
Message |
build()
Construct the final message. |
Message |
buildPartial()
Like build() , but does not throw an exception if the message is
missing required fields. |
Message.Builder |
clear()
Resets all fields to their default values. |
Message.Builder |
clone()
Clones the Builder. |
Message |
getDefaultInstanceForType()
Get the message's type's default instance. |
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise. |
Message.Builder |
mergeFrom(Message other)
Merge other into the message being built. |
Message.Builder |
readFrom(JsonStream input)
Merge input into the message being built. |
Method Detail |
---|
Message.Builder clear()
Message.Builder mergeFrom(Message other)
other
into the message being built. other
must
have the exact same type as this
.
Merging occurs as follows. For each field:other
, then other
's value
overwrites the value in this message.other
, it is merged into the corresponding
sub-message of this message using the same merging rules.other
are concatenated with the
elements in this message.
This is equivalent to the Message::MergeFrom
method in C++.
Message.Builder readFrom(JsonStream input) throws IOException
input
into the message being built.
IOException
Message build()
build()
, clone()
it first.
UninitializedMessageException
- The message is missing one or more
required fields (i.e. isInitialized()
returns false) .
Use buildPartial()
to
bypass this check.Message buildPartial()
build()
, but does not throw an exception if the message is
missing required fields. Instead, a partial message is returned. Once
this is called, the Builder is no longer valid, and calling any will
result in undefined behavior and may throw a NullPointerException.
If you need to continue working with the builder after calling buildPartial()
, clone()
it first.
Message.Builder clone()
Object.clone()
boolean isInitialized()
Message getDefaultInstanceForType()
Message.getDefaultInstanceForType()
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |