|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.protobuf.AbstractMessage com.google.protobuf.GeneratedMessage
public abstract class GeneratedMessage
All generated protocol message classes extend this class. This class implements most of the Message and Builder interfaces using Java reflection. Users can ignore this class and pretend that generated messages implement the Message interface directly.
Nested Class Summary | |
---|---|
static class |
GeneratedMessage.Builder<BuilderType extends GeneratedMessage.Builder>
|
static class |
GeneratedMessage.ExtendableBuilder<MessageType extends GeneratedMessage.ExtendableMessage,BuilderType extends GeneratedMessage.ExtendableBuilder>
Generated message builders for message types that contain extension ranges subclass this. |
static class |
GeneratedMessage.ExtendableMessage<MessageType extends GeneratedMessage.ExtendableMessage>
Generated message classes for message types that contain extension ranges subclass this. |
static class |
GeneratedMessage.FieldAccessorTable
Users should ignore this class. |
static class |
GeneratedMessage.GeneratedExtension<ContainingType extends Message,Type>
Type used to represent generated extensions. |
Constructor Summary | |
---|---|
protected |
GeneratedMessage()
|
Method Summary | ||
---|---|---|
java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> |
getAllFields()
Returns a collection of all the fields in this message which are set and their corresponding values. |
|
Descriptors.Descriptor |
getDescriptorForType()
Get the message's type's descriptor. |
|
java.lang.Object |
getField(Descriptors.FieldDescriptor field)
Obtains the value of the given field, or the default value if it is not set. |
|
java.lang.Object |
getRepeatedField(Descriptors.FieldDescriptor field,
int index)
Gets an element of a repeated field. |
|
int |
getRepeatedFieldCount(Descriptors.FieldDescriptor field)
Gets the number of elements of a repeated field. |
|
UnknownFieldSet |
getUnknownFields()
Get the UnknownFieldSet for this message. |
|
boolean |
hasField(Descriptors.FieldDescriptor field)
Returns true if the given field is set. |
|
protected abstract GeneratedMessage.FieldAccessorTable |
internalGetFieldAccessorTable()
Get the FieldAccessorTable for this type. |
|
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise. |
|
static
|
newGeneratedExtension(Descriptors.FieldDescriptor descriptor,
java.lang.Class<Type> type)
For use by generated code only. |
|
static
|
newRepeatedGeneratedExtension(Descriptors.FieldDescriptor descriptor,
java.lang.Class<Type> type)
For use by generated code only. |
Methods inherited from class com.google.protobuf.AbstractMessage |
---|
equals, getSerializedSize, hashCode, toByteArray, toByteString, toString, writeDelimitedTo, writeTo, writeTo |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.protobuf.Message |
---|
getDefaultInstanceForType, newBuilderForType, toBuilder |
Constructor Detail |
---|
protected GeneratedMessage()
Method Detail |
---|
protected abstract GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
public Descriptors.Descriptor getDescriptorForType()
Message
getDescriptor()
method of generated message classes in that
this method is an abstract method of the Message
interface
whereas getDescriptor()
is a static method of a specific class.
They return the same thing.
public boolean isInitialized()
Message
isInitialized
in interface Message
isInitialized
in class AbstractMessage
public java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> getAllFields()
Message
Message.getField(Descriptors.FieldDescriptor)
for each field. The map
is guaranteed to be a sorted map, so iterating over it will return fields
in order by field number.
public boolean hasField(Descriptors.FieldDescriptor field)
Message
public java.lang.Object getField(Descriptors.FieldDescriptor field)
Message
public int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
Message
public java.lang.Object getRepeatedField(Descriptors.FieldDescriptor field, int index)
Message
public final UnknownFieldSet getUnknownFields()
Message
UnknownFieldSet
for this message.
public static <ContainingType extends Message,Type> GeneratedMessage.GeneratedExtension<ContainingType,Type> newGeneratedExtension(Descriptors.FieldDescriptor descriptor, java.lang.Class<Type> type)
public static <ContainingType extends Message,Type> GeneratedMessage.GeneratedExtension<ContainingType,java.util.List<Type>> newRepeatedGeneratedExtension(Descriptors.FieldDescriptor descriptor, java.lang.Class<Type> type)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |