public abstract class GeneratedMessage extends AbstractMessage implements Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
GeneratedMessage.Builder<BuilderType extends GeneratedMessage.Builder<BuilderType>> |
protected static interface |
GeneratedMessage.BuilderParent
TODO(xiaofeng): remove this after b/29368482 is fixed.
|
static class |
GeneratedMessage.ExtendableBuilder<MessageType extends GeneratedMessage.ExtendableMessage,BuilderType extends GeneratedMessage.ExtendableBuilder<MessageType,BuilderType>>
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 interface |
GeneratedMessage.ExtendableMessageOrBuilder<MessageType extends GeneratedMessage.ExtendableMessage> |
static class |
GeneratedMessage.FieldAccessorTable
Users should ignore this class.
|
static class |
GeneratedMessage.GeneratedExtension<ContainingType extends Message,Type>
Type used to represent generated extensions.
|
AbstractMessageLite.InternalOneOfEnum| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
alwaysUseFieldBuilders
For testing.
|
protected UnknownFieldSet |
unknownFields
For use by generated code only.
|
memoizedSizememoizedHashCode| Modifier | Constructor and Description |
|---|---|
protected |
GeneratedMessage() |
protected |
GeneratedMessage(GeneratedMessage.Builder<?> builder) |
| Modifier and Type | Method and Description |
|---|---|
protected static int |
computeStringSize(int fieldNumber,
Object value) |
protected static int |
computeStringSizeNoTag(Object value) |
Map<Descriptors.FieldDescriptor,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.
|
Object |
getField(Descriptors.FieldDescriptor field)
Obtains the value of the given field, or the default value if it is not set.
|
Descriptors.FieldDescriptor |
getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
TODO(jieluo): Clear it when all subclasses have implemented this method.
|
Parser<? extends GeneratedMessage> |
getParserForType()
Gets the parser for a message of the same type as this message.
|
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.
|
int |
getSerializedSize()
Get the number of bytes required to encode this message.
|
UnknownFieldSet |
getUnknownFields()
Get the
UnknownFieldSet for this message. |
boolean |
hasField(Descriptors.FieldDescriptor field)
Returns true if the given field is set.
|
boolean |
hasOneof(Descriptors.OneofDescriptor oneof)
TODO(jieluo): Clear it when all subclasses have implemented this method.
|
protected abstract GeneratedMessage.FieldAccessorTable |
internalGetFieldAccessorTable()
Get the FieldAccessorTable for this type.
|
protected MapField |
internalGetMapField(int fieldNumber)
Gets the map field with the given field number.
|
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 Message.Builder |
newBuilderForType(AbstractMessage.BuilderParent parent)
Create a nested builder.
|
protected abstract Message.Builder |
newBuilderForType(GeneratedMessage.BuilderParent parent)
TODO(xiaofeng): remove this together with GeneratedMessage.BuilderParent.
|
static <ContainingType extends Message,Type> |
newFileScopedGeneratedExtension(Class singularType,
Message defaultInstance)
For use by generated code only.
|
static <ContainingType extends Message,Type> |
newFileScopedGeneratedExtension(Class singularType,
Message defaultInstance,
String descriptorOuterClass,
String extensionName)
Used in proto1 generated code only.
|
static <ContainingType extends Message,Type> |
newMessageScopedGeneratedExtension(Message scope,
int descriptorIndex,
Class singularType,
Message defaultInstance)
For use by generated code only.
|
static <ContainingType extends Message,Type> |
newMessageScopedGeneratedExtension(Message scope,
String name,
Class singularType,
Message defaultInstance)
Used in proto1 generated code only.
|
protected static <M extends Message> |
parseDelimitedWithIOException(Parser<M> parser,
InputStream input) |
protected static <M extends Message> |
parseDelimitedWithIOException(Parser<M> parser,
InputStream input,
ExtensionRegistryLite extensions) |
protected boolean |
parseUnknownField(CodedInputStream input,
UnknownFieldSet.Builder unknownFields,
ExtensionRegistryLite extensionRegistry,
int tag)
Called by subclasses to parse an unknown field.
|
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
CodedInputStream input) |
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
CodedInputStream input,
ExtensionRegistryLite extensions) |
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
InputStream input) |
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
InputStream input,
ExtensionRegistryLite extensions) |
protected Object |
writeReplace()
Replaces this object in the output stream with a serialized form.
|
protected static void |
writeString(CodedOutputStream output,
int fieldNumber,
Object value) |
protected static void |
writeStringNoTag(CodedOutputStream output,
Object value) |
void |
writeTo(CodedOutputStream output)
Serializes the message and writes it to
output. |
equals, findInitializationErrors, getInitializationErrorString, hashBoolean, hashCode, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitnewBuilderForType, toBuildertoByteArray, toByteString, writeDelimitedTo, writeTogetDefaultInstanceForTypeprotected static boolean alwaysUseFieldBuilders
protected UnknownFieldSet unknownFields
protected GeneratedMessage()
protected GeneratedMessage(GeneratedMessage.Builder<?> builder)
public Parser<? extends GeneratedMessage> getParserForType()
MessageLitegetParserForType in interface MessagegetParserForType in interface MessageLiteprotected abstract GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
public Descriptors.Descriptor getDescriptorForType()
MessageOrBuildergetDescriptor() 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.getDescriptorForType in interface MessageOrBuilderpublic boolean isInitialized()
MessageLiteOrBuilderisInitialized in interface MessageLiteOrBuilderisInitialized in class AbstractMessagepublic Map<Descriptors.FieldDescriptor,Object> getAllFields()
MessageOrBuilderMessageOrBuilder.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. getAllFields in interface MessageOrBuilderpublic boolean hasOneof(Descriptors.OneofDescriptor oneof)
AbstractMessagehasOneof in interface MessageOrBuilderhasOneof in class AbstractMessagepublic Descriptors.FieldDescriptor getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
AbstractMessagegetOneofFieldDescriptor in interface MessageOrBuildergetOneofFieldDescriptor in class AbstractMessagepublic boolean hasField(Descriptors.FieldDescriptor field)
MessageOrBuilderhasField in interface MessageOrBuilderpublic Object getField(Descriptors.FieldDescriptor field)
MessageOrBuildergetField in interface MessageOrBuilderpublic int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
MessageOrBuildergetRepeatedFieldCount in interface MessageOrBuilderpublic Object getRepeatedField(Descriptors.FieldDescriptor field, int index)
MessageOrBuildergetRepeatedField in interface MessageOrBuilderpublic UnknownFieldSet getUnknownFields()
MessageOrBuilderUnknownFieldSet for this message.getUnknownFields in interface MessageOrBuilderprotected boolean parseUnknownField(CodedInputStream input, UnknownFieldSet.Builder unknownFields, ExtensionRegistryLite extensionRegistry, int tag) throws IOException
true unless the tag is an end-group tag.IOExceptionprotected static <M extends Message> M parseWithIOException(Parser<M> parser, InputStream input) throws IOException
IOExceptionprotected static <M extends Message> M parseWithIOException(Parser<M> parser, InputStream input, ExtensionRegistryLite extensions) throws IOException
IOExceptionprotected static <M extends Message> M parseWithIOException(Parser<M> parser, CodedInputStream input) throws IOException
IOExceptionprotected static <M extends Message> M parseWithIOException(Parser<M> parser, CodedInputStream input, ExtensionRegistryLite extensions) throws IOException
IOExceptionprotected static <M extends Message> M parseDelimitedWithIOException(Parser<M> parser, InputStream input) throws IOException
IOExceptionprotected static <M extends Message> M parseDelimitedWithIOException(Parser<M> parser, InputStream input, ExtensionRegistryLite extensions) throws IOException
IOExceptionpublic void writeTo(CodedOutputStream output) throws IOException
MessageLiteoutput. This does not flush or close the
stream.writeTo in interface MessageLitewriteTo in class AbstractMessageIOExceptionpublic int getSerializedSize()
MessageLitegetSerializedSize in interface MessageLitegetSerializedSize in class AbstractMessageprotected void makeExtensionsImmutable()
protected abstract Message.Builder newBuilderForType(GeneratedMessage.BuilderParent parent)
protected Message.Builder newBuilderForType(AbstractMessage.BuilderParent parent)
AbstractMessagenewBuilderForType in class AbstractMessagepublic 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 MapField internalGetMapField(int fieldNumber)
protected Object writeReplace() throws ObjectStreamException
return super.writeReplace();ObjectStreamExceptionprotected static int computeStringSize(int fieldNumber,
Object value)
protected static int computeStringSizeNoTag(Object value)
protected static void writeString(CodedOutputStream output, int fieldNumber, Object value) throws IOException
IOExceptionprotected static void writeStringNoTag(CodedOutputStream output, Object value) throws IOException
IOExceptionCopyright © 2008–2019. All rights reserved.