See also MessageLite, which defines most of the methods that typical users care about.
Message adds to it methods that are not available in the "lite" runtime. The biggest
added features are introspection and reflection -- i.e., getting descriptors for the message type
and accessing the field values dynamically.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Message.Builder
Abstract interface implemented by Protocol Message builders. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public Parser | getParserForType()
Redeclares com. |
| public int | Returns: the hash code value for this messageReturns the hash code value for this message. |
| public Message. | newBuilderForType()
Redeclares com. |
| public Message. | toBuilder()
Redeclares com. |
| public String |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Compares the specified object with this message for equality. Returns | |
| getParserForType | back to summary |
|---|---|
| public Parser Redeclares com. Doc from com. Gets the parser for a message of the same type as this message.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Returns the hash code value for this message. The hash code of a message should mix the
message's type (object identity of the descriptor) with its contents (known and unknown field
values). Subclasses must implement this; inheriting
| |
| newBuilderForType | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Constructs a new builder for a message of the same type as this message.
| |
| toBuilder | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Constructs a builder initialized with the current message. Use this to derive a new message from the current one.
| |
| toString | back to summary |
|---|---|
| public String toString() Converts the message to a string in protocol buffer text format. This is just a trivial wrapper
around
| |
| Modifier and Type | Method and Description |
|---|---|
| public Message. | addRepeatedField(Descriptors.
Like |
| public Message | build()
Redeclares com. |
| public Message | buildPartial()
Redeclares com. build(), but does not throw an exception if the message is missing required
fields.
|
| public Message. | clear()
Redeclares com. |
| public Message. | |
| public Message. | |
| public Message. | |
| public Descriptors. | getDescriptorForType()
Redeclares com. |
| public Message. | getFieldBuilder(Descriptors.
Get a nested builder instance for the given field. |
| public Message. | getRepeatedFieldBuilder(Descriptors.
Get a nested builder instance for the given repeated field instance. |
| public boolean | mergeDelimitedFrom(InputStream input)
Redeclares com. mergeFrom(InputStream), but does not read until EOF.
|
| public boolean | mergeDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Redeclares com. mergeDelimitedFrom(InputStream) but supporting extensions.
|
| public Message. | |
| public Message. | mergeFrom(CodedInputStream input)
Redeclares com. |
| public Message. | mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Redeclares com. Builder#mergeFrom(CodedInputStream), but also parses extensions.
|
| public Message. | mergeFrom(ByteString data)
Redeclares com. data as a message of this type and merge it with the message being built.
|
| public Message. | mergeFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Redeclares com. data as a message of this type and merge it with the message being built.
|
| public Message. | mergeFrom(byte[] data)
Redeclares com. data as a message of this type and merge it with the message being built.
|
| public Message. | mergeFrom(byte[] data, int off, int len)
Redeclares com. data as a message of this type and merge it with the message being built.
|
| public Message. | mergeFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Redeclares com. data as a message of this type and merge it with the message being built.
|
| public Message. | mergeFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)
Redeclares com. data as a message of this type and merge it with the message being built.
|
| public Message. | mergeFrom(InputStream input)
Redeclares com. input and merge it with the message being built.
|
| public Message. | mergeFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Redeclares com. input and merge it with the message being built.
|
| public Message. | mergeUnknownFields(UnknownFieldSet unknownFields)
Merge some unknown fields into the |
| public Message. | newBuilderForField(Descriptors.
Create a builder for messages of the appropriate type for the given field. |
| public Message. | |
| public Message. | setRepeatedField(Descriptors.
Sets an element of a repeated field to the given value. |
| public Message. |
| addRepeatedField | back to summary |
|---|---|
| public Message. Like
| |
| build | back to summary |
|---|---|
| public Message build() Redeclares com. Doc from com. Constructs the message based on the state of the Builder. Subsequent changes to the Builder will not affect the returned message.
| |
| buildPartial | back to summary |
|---|---|
| public Message buildPartial() Redeclares com. Doc from com. Like
| |
| clear | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Resets all fields to their default values.
| |
| clearField | back to summary |
|---|---|
| public Message. Clears the field. This is exactly equivalent to calling the generated "clear" accessor method corresponding to the field. | |
| clearOneof | back to summary |
|---|---|
| public Message. Clears the oneof. This is exactly equivalent to calling the generated "clear" accessor method corresponding to the oneof. | |
| clone | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Clones the Builder.
| |
| getDescriptorForType | back to summary |
|---|---|
| public Descriptors. Redeclares com. Get the message's type's descriptor. See
| |
| getFieldBuilder | back to summary |
|---|---|
| public Message. Get a nested builder instance for the given field. Normally, we hold a reference to the immutable message object for the message type field. Some implementations(the generated message builders), however, can also hold a reference to the builder object (a nested builder) for the field. If the field is already backed up by a nested builder, the nested builder will be returned. Otherwise, a new field builder will be created and returned. The original message field (if exist) will be merged into the field builder, which will then be nested into its parent builder. Note implementations that do not support nested builders will throw | |
| getRepeatedFieldBuilder | back to summary |
|---|---|
| public Message. Get a nested builder instance for the given repeated field instance. Normally, we hold a reference to the immutable message object for the message type field. Some implementations(the generated message builders), however, can also hold a reference to the builder object (a nested builder) for the field. If the field is already backed up by a nested builder, the nested builder will be returned. Otherwise, a new field builder will be created and returned. The original message field (if exist) will be merged into the field builder, which will then be nested into its parent builder. Note implementations that do not support nested builders will throw | |
| mergeDelimitedFrom | back to summary |
|---|---|
| public boolean mergeDelimitedFrom(InputStream input) throws IOException Redeclares com. Doc from com. Like
| |
| mergeDelimitedFrom | back to summary |
|---|---|
| public boolean mergeDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException Redeclares com. Doc from com. Like
| |
| mergeFrom | back to summary |
|---|---|
| public Message. Merge Merging occurs as follows. For each field: This is equivalent to the | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parses a message of this type from the input and merges it with this message. Warning: This does not verify that all required fields are present in the input message.
If you call
Note The caller should call
| |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Like
| |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse a message of this type from Despite usually reading the entire input, this does not close the stream. | |
| mergeFrom | back to summary |
|---|---|
| public Message. Redeclares com. Doc from com. Parse a message of this type from | |
| mergeUnknownFields | back to summary |
|---|---|
| public Message. Merge some unknown fields into the | |
| newBuilderForField | back to summary |
|---|---|
| public Message. Create a builder for messages of the appropriate type for the given field. The
builder is NOT nested in the current builder. However, messages built with the
builder can then be passed to the To obtain a builder nested in the current builder, use
| |
| setField | back to summary |
|---|---|
| public Message. Sets a field to the given value. The value must be of the correct type for this field, i.e.
the same type that | |
| setRepeatedField | back to summary |
|---|---|
| public Message. Sets an element of a repeated field to the given value. The value must be of the correct type
for this field, i.e. the same type that
| |
| setUnknownFields | back to summary |
|---|---|
| public Message. Set the | |