public abstract class GeneratedMessageV3 extends AbstractMessage implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
GeneratedMessageV3.Builder<BuilderT extends GeneratedMessageV3.Builder<BuilderT>>
Builder class for
GeneratedMessageV3 . |
protected static interface |
GeneratedMessageV3.BuilderParent
TODO: remove this after b/29368482 is fixed.
|
static class |
GeneratedMessageV3.ExtendableBuilder<MessageT extends GeneratedMessageV3.ExtendableMessage<MessageT>,BuilderT extends GeneratedMessageV3.ExtendableBuilder<MessageT,BuilderT>>
Generated message builders for message types that contain extension ranges subclass this.
|
static class |
GeneratedMessageV3.ExtendableMessage<MessageT extends GeneratedMessageV3.ExtendableMessage<MessageT>>
Generated message classes for message types that contain extension ranges subclass this.
|
static interface |
GeneratedMessageV3.ExtendableMessageOrBuilder<MessageT extends GeneratedMessageV3.ExtendableMessage<MessageT>>
Extends
MessageOrBuilder with extension-related functions. |
static class |
GeneratedMessageV3.FieldAccessorTable
Users should ignore this class.
|
protected static class |
GeneratedMessageV3.UnusedPrivateParameter
This class is used to make a generated protected method inaccessible from user's code (e.g.,
the
newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter) method below). |
AbstractMessageLite.InternalOneOfEnum
Modifier and Type | Field and Description |
---|---|
protected static boolean |
alwaysUseFieldBuilders
For testing.
|
protected UnknownFieldSet |
unknownFields
For use by generated code only.
|
memoizedSize
memoizedHashCode
Modifier | Constructor and Description |
---|---|
protected |
GeneratedMessageV3() |
protected |
GeneratedMessageV3(GeneratedMessageV3.Builder<?> builder) |
Modifier and Type | Method and Description |
---|---|
protected static boolean |
canUseUnsafe() |
protected static int |
computeStringSize(int fieldNumber,
Object value) |
protected static int |
computeStringSizeNoTag(Object value) |
protected static Internal.BooleanList |
emptyBooleanList() |
protected static Internal.DoubleList |
emptyDoubleList() |
protected static Internal.FloatList |
emptyFloatList() |
protected static Internal.IntList |
emptyIntList() |
protected static <T> Internal.ProtobufList<T> |
emptyList(Class<T> elementType) |
protected static Internal.LongList |
emptyLongList() |
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)
Obtains the FieldDescriptor if the given oneof is set.
|
Parser<? extends GeneratedMessageV3> |
getParserForType()
TODO: Remove this unnecessary intermediate implementation of this method.
|
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)
Returns true if the given oneof is set.
|
protected abstract GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable()
Get the FieldAccessorTable for this type.
|
protected MapField |
internalGetMapField(int fieldNumber)
Deprecated.
|
protected MapFieldReflectionAccessor |
internalGetMapFieldReflection(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 static boolean |
isStringEmpty(Object value) |
protected void |
makeExtensionsImmutable()
Used by parsing constructors in generated classes.
|
protected static <ListT extends Internal.ProtobufList<?>> |
makeMutableCopy(ListT list) |
protected static <ListT extends Internal.ProtobufList<?>> |
makeMutableCopy(ListT list,
int minCapacity) |
protected void |
mergeFromAndMakeImmutableInternal(CodedInputStream input,
ExtensionRegistryLite extensionRegistry)
Deprecated.
use newBuilder().mergeFrom() instead
|
protected static Internal.BooleanList |
mutableCopy(Internal.BooleanList list) |
protected static Internal.DoubleList |
mutableCopy(Internal.DoubleList list) |
protected static Internal.FloatList |
mutableCopy(Internal.FloatList list) |
protected static Internal.IntList |
mutableCopy(Internal.IntList list) |
protected static Internal.LongList |
mutableCopy(Internal.LongList list) |
protected static Internal.BooleanList |
newBooleanList() |
protected Message.Builder |
newBuilderForType(AbstractMessage.BuilderParent parent)
TODO: generated class should implement this directly
|
protected abstract Message.Builder |
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
TODO: remove this together with GeneratedMessageV3.BuilderParent.
|
protected static Internal.DoubleList |
newDoubleList() |
protected static Internal.FloatList |
newFloatList() |
protected Object |
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Creates a new instance of this message type.
|
protected static Internal.IntList |
newIntList() |
protected static Internal.LongList |
newLongList() |
protected static <M extends Message> |
parseDelimitedWithIOException(Parser<M> parser,
InputStream input)
Used by generated code.
|
protected static <M extends Message> |
parseDelimitedWithIOException(Parser<M> parser,
InputStream input,
ExtensionRegistryLite extensions)
Used by generated code.
|
protected boolean |
parseUnknownField(CodedInputStream input,
UnknownFieldSet.Builder unknownFields,
ExtensionRegistryLite extensionRegistry,
int tag)
Called by subclasses to parse an unknown field.
|
protected boolean |
parseUnknownFieldProto3(CodedInputStream input,
UnknownFieldSet.Builder unknownFields,
ExtensionRegistryLite extensionRegistry,
int tag)
Delegates to parseUnknownField.
|
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
CodedInputStream input)
Used by generated code.
|
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
CodedInputStream input,
ExtensionRegistryLite extensions)
Used by generated code.
|
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
InputStream input)
Used by generated code.
|
protected static <M extends Message> |
parseWithIOException(Parser<M> parser,
InputStream input,
ExtensionRegistryLite extensions)
Used by generated code.
|
protected static <V> void |
serializeBooleanMapTo(CodedOutputStream out,
MapField<Boolean,V> field,
MapEntry<Boolean,V> defaultEntry,
int fieldNumber) |
protected static <V> void |
serializeIntegerMapTo(CodedOutputStream out,
MapField<Integer,V> field,
MapEntry<Integer,V> defaultEntry,
int fieldNumber) |
protected static <V> void |
serializeLongMapTo(CodedOutputStream out,
MapField<Long,V> field,
MapEntry<Long,V> defaultEntry,
int fieldNumber) |
protected static <V> void |
serializeStringMapTo(CodedOutputStream out,
MapField<String,V> field,
MapEntry<String,V> defaultEntry,
int fieldNumber) |
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, toString
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
newBuilderForType, toBuilder
toByteArray, toByteString, writeDelimitedTo, writeTo
getDefaultInstanceForType
protected static boolean alwaysUseFieldBuilders
protected UnknownFieldSet unknownFields
TODO: mark this private and final (breaking change)
protected GeneratedMessageV3()
protected GeneratedMessageV3(GeneratedMessageV3.Builder<?> builder)
public Parser<? extends GeneratedMessageV3> getParserForType()
getParserForType
in interface Message
getParserForType
in interface MessageLite
protected abstract GeneratedMessageV3.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.getDescriptorForType
in interface MessageOrBuilder
@Deprecated protected void mergeFromAndMakeImmutableInternal(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public boolean isInitialized()
MessageLiteOrBuilder
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class AbstractMessage
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. getAllFields
in interface MessageOrBuilder
public boolean hasOneof(Descriptors.OneofDescriptor oneof)
MessageOrBuilder
hasOneof
in interface MessageOrBuilder
hasOneof
in class AbstractMessage
public Descriptors.FieldDescriptor getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
MessageOrBuilder
getOneofFieldDescriptor
in interface MessageOrBuilder
getOneofFieldDescriptor
in class AbstractMessage
public boolean hasField(Descriptors.FieldDescriptor field)
MessageOrBuilder
hasField
in interface MessageOrBuilder
public Object getField(Descriptors.FieldDescriptor field)
MessageOrBuilder
getField
in interface MessageOrBuilder
public int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
MessageOrBuilder
getRepeatedFieldCount
in interface MessageOrBuilder
public Object getRepeatedField(Descriptors.FieldDescriptor field, int index)
MessageOrBuilder
getRepeatedField
in interface MessageOrBuilder
public UnknownFieldSet getUnknownFields()
MessageOrBuilder
UnknownFieldSet
for this message.getUnknownFields
in interface MessageOrBuilder
protected boolean parseUnknownField(CodedInputStream input, UnknownFieldSet.Builder unknownFields, ExtensionRegistryLite extensionRegistry, int tag) throws IOException
TODO remove this method
true
unless the tag is an end-group tag.IOException
protected boolean parseUnknownFieldProto3(CodedInputStream input, UnknownFieldSet.Builder unknownFields, ExtensionRegistryLite extensionRegistry, int tag) throws IOException
TODO remove this method
IOException
protected static <M extends Message> M parseWithIOException(Parser<M> parser, InputStream input) throws IOException
IOException
protected static <M extends Message> M parseWithIOException(Parser<M> parser, InputStream input, ExtensionRegistryLite extensions) throws IOException
IOException
protected static <M extends Message> M parseWithIOException(Parser<M> parser, CodedInputStream input) throws IOException
IOException
protected static <M extends Message> M parseWithIOException(Parser<M> parser, CodedInputStream input, ExtensionRegistryLite extensions) throws IOException
IOException
protected static <M extends Message> M parseDelimitedWithIOException(Parser<M> parser, InputStream input) throws IOException
IOException
protected static <M extends Message> M parseDelimitedWithIOException(Parser<M> parser, InputStream input, ExtensionRegistryLite extensions) throws IOException
IOException
protected static boolean canUseUnsafe()
protected static Internal.IntList emptyIntList()
protected static Internal.IntList newIntList()
protected static Internal.IntList mutableCopy(Internal.IntList list)
protected static Internal.LongList mutableCopy(Internal.LongList list)
protected static Internal.FloatList mutableCopy(Internal.FloatList list)
protected static Internal.DoubleList mutableCopy(Internal.DoubleList list)
protected static Internal.BooleanList mutableCopy(Internal.BooleanList list)
protected static Internal.LongList emptyLongList()
protected static Internal.LongList newLongList()
protected static Internal.FloatList emptyFloatList()
protected static Internal.FloatList newFloatList()
protected static Internal.DoubleList emptyDoubleList()
protected static Internal.DoubleList newDoubleList()
protected static Internal.BooleanList emptyBooleanList()
protected static Internal.BooleanList newBooleanList()
protected static <ListT extends Internal.ProtobufList<?>> ListT makeMutableCopy(ListT list)
protected static <ListT extends Internal.ProtobufList<?>> ListT makeMutableCopy(ListT list, int minCapacity)
protected static <T> Internal.ProtobufList<T> emptyList(Class<T> elementType)
public void writeTo(CodedOutputStream output) throws IOException
MessageLite
output
. This does not flush or close the
stream.writeTo
in interface MessageLite
writeTo
in class AbstractMessage
IOException
public int getSerializedSize()
MessageLite
getSerializedSize
in interface MessageLite
getSerializedSize
in class AbstractMessage
protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected void makeExtensionsImmutable()
TODO: remove unused method (extensions should be immutable after build)
protected abstract Message.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected Message.Builder newBuilderForType(AbstractMessage.BuilderParent parent)
newBuilderForType
in class AbstractMessage
protected MapFieldReflectionAccessor internalGetMapFieldReflection(int fieldNumber)
Unlike other field types, reflection support for map fields can't be implemented based on generated public API because we need to access a map field as a list in reflection API but the generated API only allows us to access it as a map. This method returns the underlying map field directly and thus enables us to access the map field as a list.
@Deprecated protected MapField internalGetMapField(int fieldNumber)
protected Object writeReplace() throws ObjectStreamException
return
super.writeReplace();
ObjectStreamException
protected static boolean isStringEmpty(Object value)
protected 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
IOException
protected static void writeStringNoTag(CodedOutputStream output, Object value) throws IOException
IOException
protected static <V> void serializeIntegerMapTo(CodedOutputStream out, MapField<Integer,V> field, MapEntry<Integer,V> defaultEntry, int fieldNumber) throws IOException
IOException
protected static <V> void serializeLongMapTo(CodedOutputStream out, MapField<Long,V> field, MapEntry<Long,V> defaultEntry, int fieldNumber) throws IOException
IOException
protected static <V> void serializeStringMapTo(CodedOutputStream out, MapField<String,V> field, MapEntry<String,V> defaultEntry, int fieldNumber) throws IOException
IOException
protected static <V> void serializeBooleanMapTo(CodedOutputStream out, MapField<Boolean,V> field, MapEntry<Boolean,V> defaultEntry, int fieldNumber) throws IOException
IOException
Copyright © 2008–2024. All rights reserved.