public abstract class GeneratedMessage extends AbstractMessageimplements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
GeneratedMessage
|
protected static interface |
GeneratedMessage
Interface for the parent of a Builder that allows the builder to communicate invalidations back to the parent for use when using nested builders.
|
static class |
GeneratedMessage
Generated message builders for message types that contain extension ranges subclass this.
|
static class |
GeneratedMessage
Generated message classes for message types that contain extension ranges subclass this.
|
static interface |
GeneratedMessage
|
static class |
GeneratedMessage
Users should ignore this class.
|
static class |
GeneratedMessage
Type used to represent generated extensions.
|
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
alwaysUseFieldBuilders
For testing.
|
memoizedHashCode| Modifier | Constructor and Description |
|---|---|
protected |
GeneratedMessage()
|
protected |
GeneratedMessage(GeneratedMessage
|
| Modifier and Type | Method and Description |
|---|---|
Map |
getAllFields()
Returns a collection of all the fields in this message which are set and their corresponding values.
|
Descriptors |
getDescriptorForType()
Get the message's type's descriptor.
|
Object |
getField(Descriptors
Obtains the value of the given field, or the default value if it is not set.
|
Descriptors |
getOneofFieldDescriptor(Descriptors
TODO(jieluo): Clear it when all subclasses have implemented this method.
|
Parser |
getParserForType()
Gets the parser for a message of the same type as this message.
|
Object |
getRepeatedField(Descriptors
Gets an element of a repeated field.
|
int |
getRepeatedFieldCount(Descriptors
Gets the number of elements of a repeated field.
|
UnknownFieldSet |
getUnknownFields()
Get the
UnknownFieldSet for this message.
|
boolean |
hasField(Descriptors
Returns true if the given field is set.
|
boolean |
hasOneof(Descriptors
TODO(jieluo): Clear it when all subclasses have implemented this method.
|
protected abstract GeneratedMessage |
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.
|
protected void |
makeExtensionsImmutable()
Used by parsing constructors in generated classes.
|
protected abstract Message |
newBuilderForType(GeneratedMessage
|
static <ContainingType extends Message |
newFileScopedGeneratedExtension(Class
For use by generated code only.
|
static <ContainingType extends Message |
newFileScopedGeneratedExtension(Class
Used in proto1 generated code only.
|
static <ContainingType extends Message |
newMessageScopedGeneratedExtension(Message
For use by generated code only.
|
static <ContainingType extends Message |
newMessageScopedGeneratedExtension(Message
Used in proto1 generated code only.
|
protected boolean |
parseUnknownField(CodedInputStream
Called by subclasses to parse an unknown field.
|
protected Object |
writeReplace()
Replaces this object in the output stream with a serialized form.
|
equals, findInitializationErrors, getInitializationErrorString, getSerializedSize, hashCode, hashFields, toString, writeTocheckByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitnewBuilderForType, toBuildertoByteArray, toByteString, writeDelimitedTo, writeTogetDefaultInstanceForTypeprotected static boolean alwaysUseFieldBuilders
protected GeneratedMessage()
protected GeneratedMessage(GeneratedMessage.Builder <?> builder)
public Parser<? extends GeneratedMessage > getParserForType()
MessageLite
protected abstract GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
public Descriptors.Descriptor getDescriptorForType()
MessageOrBuilder
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()
MessageLiteOrBuilder
public Map<Descriptors .FieldDescriptor ,Object > getAllFields()
MessageOrBuilder
MessageOrBuilder.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 hasOneof(Descriptors.OneofDescriptor oneof)
AbstractMessage
public Descriptors.FieldDescriptor getOneofFieldDescriptor(Descriptors .OneofDescriptor oneof)
AbstractMessage
public boolean hasField(Descriptors.FieldDescriptor field)
MessageOrBuilder
public ObjectgetField(Descriptors .FieldDescriptor field)
MessageOrBuilder
public int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
MessageOrBuilder
public ObjectgetRepeatedField(Descriptors .FieldDescriptor field, int index)
MessageOrBuilder
public UnknownFieldSetgetUnknownFields()
MessageOrBuilder
UnknownFieldSet for this message.
protected boolean parseUnknownField(CodedInputStreaminput, UnknownFieldSet .Builder unknownFields, ExtensionRegistryLite extensionRegistry, int tag) throws IOException
true unless the tag is an end-group tag.
IOException
protected void makeExtensionsImmutable()
protected abstract Message.Builder newBuilderForType(GeneratedMessage .BuilderParent parent)
public static <ContainingType extends Message,Type> GeneratedMessage .GeneratedExtension <ContainingType ,Type> newMessageScopedGeneratedExtension(Message scope, int descriptorIndex, Class singularType, Message defaultInstance)
public static <ContainingType extends Message,Type> GeneratedMessage .GeneratedExtension <ContainingType ,Type> newFileScopedGeneratedExtension(Class singularType, Message defaultInstance)
public static <ContainingType extends Message,Type> GeneratedMessage .GeneratedExtension <ContainingType ,Type> newMessageScopedGeneratedExtension(Message scope, String name, Class singularType, Message defaultInstance)
public static <ContainingType extends Message,Type> GeneratedMessage .GeneratedExtension <ContainingType ,Type> newFileScopedGeneratedExtension(Class singularType, Message defaultInstance, String descriptorOuterClass, String extensionName)
protected ObjectwriteReplace() throws ObjectStreamException
return super.writeReplace();
ObjectStreamException