Top Description Inners Fields Constructors Methods
com.google.protobuf

public final Class DynamicMessage

extends AbstractMessage
Class Inheritance
Static Imports
com.google.protobuf.Internal.checkNotNull

An implementation of Message that can represent arbitrary types, given a Descriptors.Descriptor.
Author
[email protected] Kenton Varda

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final FieldSet<Descriptors.FieldDescriptor>
private int
private final Descriptors.FieldDescriptor[]
private final Descriptors.Descriptor
private final UnknownFieldSet

Constructor Summary

AccessConstructor and Description
pack-priv
DynamicMessage(Descriptors.Descriptor type, FieldSet<Descriptors.FieldDescriptor> fields, Descriptors.FieldDescriptor[] oneofCases, UnknownFieldSet unknownFields)

Construct a DynamicMessage using the given FieldSet.

Method Summary

Modifier and TypeMethod and Description
public Map<Descriptors.FieldDescriptor, Object>
getAllFields()

Implements com.google.protobuf.MessageOrBuilder.getAllFields.

Returns a collection of all the fields in this message which are set and their corresponding values.
public static DynamicMessage
getDefaultInstance(Descriptors.Descriptor type)

Get a DynamicMessage representing the default instance of the given type.

public DynamicMessage
public Descriptors.Descriptor
getDescriptorForType()

Implements com.google.protobuf.MessageOrBuilder.getDescriptorForType.

Get the message's type's descriptor.
public Object
getField(Descriptors.FieldDescriptor field)

Implements com.google.protobuf.MessageOrBuilder.getField.

Obtains the value of the given field, or the default value if it is not set.
public Descriptors.FieldDescriptor
public Parser<DynamicMessage>
getParserForType()

Implements com.google.protobuf.Message.getParserForType, com.google.protobuf.MessageLite.getParserForType.

Gets the parser for a message of the same type as this message.
public Object
getRepeatedField(Descriptors.FieldDescriptor field, int index)

Implements com.google.protobuf.MessageOrBuilder.getRepeatedField.

Gets an element of a repeated field.
public int
getRepeatedFieldCount(Descriptors.FieldDescriptor field)

Implements com.google.protobuf.MessageOrBuilder.getRepeatedFieldCount.

Gets the number of elements of a repeated field.
public int
getSerializedSize()

Overrides com.google.protobuf.AbstractMessage.getSerializedSize.

Implements com.google.protobuf.MessageLite.getSerializedSize.

Get the number of bytes required to encode this message.
public UnknownFieldSet
public boolean
hasField(Descriptors.FieldDescriptor field)

Implements com.google.protobuf.MessageOrBuilder.hasField.

Returns true if the given field is set.
public boolean
hasOneof(Descriptors.OneofDescriptor oneof)

Overrides com.google.protobuf.AbstractMessage.hasOneof.

Implements com.google.protobuf.MessageOrBuilder.hasOneof.

TODO(jieluo): Clear it when all subclasses have implemented this method.
pack-priv static boolean
public boolean
isInitialized()

Overrides com.google.protobuf.AbstractMessage.isInitialized.

Implements com.google.protobuf.MessageLiteOrBuilder.isInitialized.

Returns true if all required fields in the message and all embedded messages are set, false otherwise.
public static DynamicMessage.Builder
newBuilder(Descriptors.Descriptor type)

Construct a Message.Builder for the given type.

public static DynamicMessage.Builder
newBuilder(Message prototype)

Construct a Message.Builder for a message of the same type as prototype, and initialize it with prototype's contents.

public DynamicMessage.Builder
newBuilderForType()

Implements com.google.protobuf.Message.newBuilderForType, com.google.protobuf.MessageLite.newBuilderForType.

Constructs a new builder for a message of the same type as this message.
public static DynamicMessage
parseFrom(Descriptors.Descriptor type, CodedInputStream input)

Parse a message of the given type from the given input stream.

public static DynamicMessage
parseFrom(Descriptors.Descriptor type, CodedInputStream input, ExtensionRegistry extensionRegistry)

Parse a message of the given type from the given input stream.

public static DynamicMessage
parseFrom(Descriptors.Descriptor type, ByteString data)

Parse data as a message of the given type and return it.

public static DynamicMessage
parseFrom(Descriptors.Descriptor type, ByteString data, ExtensionRegistry extensionRegistry)

Parse data as a message of the given type and return it.

public static DynamicMessage
parseFrom(Descriptors.Descriptor type, byte[] data)

Parse data as a message of the given type and return it.

public static DynamicMessage
parseFrom(Descriptors.Descriptor type, byte[] data, ExtensionRegistry extensionRegistry)

Parse data as a message of the given type and return it.

public static DynamicMessage
parseFrom(Descriptors.Descriptor type, InputStream input)

Parse a message of the given type from input and return it.

public static DynamicMessage
parseFrom(Descriptors.Descriptor type, InputStream input, ExtensionRegistry extensionRegistry)

Parse a message of the given type from input and return it.

public DynamicMessage.Builder
toBuilder()

Implements com.google.protobuf.Message.toBuilder, com.google.protobuf.MessageLite.toBuilder.

Constructs a builder initialized with the current message.
private void
verifyContainingType(Descriptors.FieldDescriptor field)

Verifies that the field is a field of this message.

private void
verifyOneofContainingType(Descriptors.OneofDescriptor oneof)

Verifies that the oneof is an oneof of this message.

public void
writeTo(CodedOutputStream output)

Overrides com.google.protobuf.AbstractMessage.writeTo.

Implements com.google.protobuf.MessageLite.writeTo.

Serializes the message and writes it to output.
Inherited from com.google.protobuf.AbstractMessage:
compareFieldsequalsfindInitializationErrorsgetInitializationErrorStringgetMemoizedSerializedSizehashBooleanhashCodehashEnumhashEnumListhashFieldshashLongnewBuilderForTypenewUninitializedMessageExceptionsetMemoizedSerializedSizetoString