MessageType - the type of the message.BuilderType - the type of the builder.public abstract class GeneratedMessageLite<MessageType extends GeneratedMessageLite<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.Builder<MessageType,BuilderType>> extends AbstractMessageLite<MessageType,BuilderType>
| Modifier and Type | Field and Description |
|---|---|
protected int |
memoizedSerializedSize
For use by generated code only.
|
protected UnknownFieldSetLite |
unknownFields
For use by generated code only.
|
memoizedHashCode| Constructor and Description |
|---|
GeneratedMessageLite() |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
dynamicMethod(GeneratedMessageLite.MethodToInvoke method)
Same as
dynamicMethod(MethodToInvoke, Object, Object) with null padding. |
protected Object |
dynamicMethod(GeneratedMessageLite.MethodToInvoke method,
Object arg0)
Same as
dynamicMethod(MethodToInvoke, Object, Object) with null padding. |
protected abstract Object |
dynamicMethod(GeneratedMessageLite.MethodToInvoke method,
Object arg0,
Object arg1)
A method that implements different types of operations described in
GeneratedMessageLite.MethodToInvoke. |
protected static Internal.BooleanList |
emptyBooleanList() |
protected static Internal.DoubleList |
emptyDoubleList() |
protected static Internal.FloatList |
emptyFloatList() |
protected static Internal.IntList |
emptyIntList() |
protected static Internal.LongList |
emptyLongList() |
protected static <E> Internal.ProtobufList<E> |
emptyProtobufList() |
boolean |
equals(Object other)
Indicates whether some other object is "equal to" this one.
|
MessageType |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
Parser<MessageType> |
getParserForType()
Gets the parser for a message of the same type as this message.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise.
|
protected static <T extends GeneratedMessageLite<T,?>> |
isInitialized(T message,
boolean shouldMemoize)
A static helper method for checking if a message is initialized, optionally memoizing.
|
protected void |
makeImmutable()
Called by subclasses to complete parsing.
|
protected static <T extends GeneratedMessageLite<T,?>> |
makeImmutable(T message) |
protected void |
mergeLengthDelimitedField(int fieldNumber,
ByteString value)
Called by subclasses to parse an unknown field.
|
protected void |
mergeUnknownFields(UnknownFieldSetLite unknownFields)
Merge some unknown fields into the
UnknownFieldSetLite for this message. |
protected void |
mergeVarintField(int tag,
int value)
Called by subclasses to parse an unknown field.
|
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 <E> Internal.ProtobufList<E> |
mutableCopy(Internal.ProtobufList<E> list) |
BuilderType |
newBuilderForType()
Constructs a new builder for a message of the same type as this message.
|
static <ContainingType extends MessageLite,Type> |
newRepeatedGeneratedExtension(ContainingType containingTypeDefaultInstance,
MessageLite messageDefaultInstance,
Internal.EnumLiteMap<?> enumTypeMap,
int number,
WireFormat.FieldType type,
boolean isPacked,
Class singularType)
For use by generated code only.
|
static <ContainingType extends MessageLite,Type> |
newSingularGeneratedExtension(ContainingType containingTypeDefaultInstance,
Type defaultValue,
MessageLite messageDefaultInstance,
Internal.EnumLiteMap<?> enumTypeMap,
int number,
WireFormat.FieldType type,
Class singularType)
For use by generated code only.
|
protected static <T extends GeneratedMessageLite<T,?>> |
parseDelimitedFrom(T defaultInstance,
InputStream input) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseDelimitedFrom(T defaultInstance,
InputStream input,
ExtensionRegistryLite extensionRegistry) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
byte[] data) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
byte[] data,
ExtensionRegistryLite extensionRegistry) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
ByteString data) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
ByteString data,
ExtensionRegistryLite extensionRegistry) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
CodedInputStream input) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
CodedInputStream input,
ExtensionRegistryLite extensionRegistry) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
InputStream input) |
protected static <T extends GeneratedMessageLite<T,?>> |
parseFrom(T defaultInstance,
InputStream input,
ExtensionRegistryLite extensionRegistry) |
protected static <T extends GeneratedMessageLite<T,?>> |
parsePartialFrom(T defaultInstance,
CodedInputStream input) |
protected boolean |
parseUnknownField(int tag,
CodedInputStream input)
Called by subclasses to parse an unknown field.
|
BuilderType |
toBuilder()
Constructs a builder initialized with the current message.
|
addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, getClass, notify, notifyAll, toString, wait, wait, waitgetSerializedSize, writeToprotected int memoizedSerializedSize
protected UnknownFieldSetLite unknownFields
@Nullable protected Object dynamicMethod(GeneratedMessageLite.MethodToInvoke method)
dynamicMethod(MethodToInvoke, Object, Object) with null padding.@Nullable protected Object dynamicMethod(GeneratedMessageLite.MethodToInvoke method, Object arg0)
dynamicMethod(MethodToInvoke, Object, Object) with null padding.@Nullable protected abstract Object dynamicMethod(GeneratedMessageLite.MethodToInvoke method, @Nullable Object arg0, @Nullable Object arg1)
GeneratedMessageLite.MethodToInvoke. Theses different
kinds of operations are required to implement message-level operations for builders in the runtime. This method
bundles those operations to reduce the generated methods count.
MERGE_FROM_STREAM is parameterized with an CodedInputStream and
ExtensionRegistryLite. It consumes the input stream, parsing the contents into the returned protocol
buffer. If parsing throws an InvalidProtocolBufferException, the implementation wraps it in a
RuntimeException.
NEW_INSTANCE returns a new instance of the protocol buffer that has not yet been made immutable. See
MAKE_IMMUTABLE.
IS_INITIALIZED is parameterized with a Boolean detailing whether to memoize. It returns
null for false and the default instance for true. We optionally memoize to support the Builder case,
where memoization is not desired.
NEW_BUILDER returns a BuilderType instance.
VISIT is parameterized with a Visitor and a MessageType and recursively iterates
through the fields side by side between this and the instance.
MAKE_IMMUTABLE sets all internal fields to an immutable state.
For use by generated code only.
protected static Internal.BooleanList emptyBooleanList()
protected static Internal.DoubleList emptyDoubleList()
protected static Internal.FloatList emptyFloatList()
protected static Internal.IntList emptyIntList()
protected static Internal.LongList emptyLongList()
protected static <E> Internal.ProtobufList<E> emptyProtobufList()
public boolean equals(@Nullable Object other)
Object
The equals method implements an equivalence relation on non-null object references:
x, x.equals(x)
should return true.
x and y,
x.equals(y) should return true if and only if y.equals(x) returns
true.
x, y, and
z, if x.equals(y) returns true and y.equals(z) returns
true, then x.equals(z) should return true.
x and y, multiple
invocations of x.equals(y) consistently return true or consistently return
false, provided no information used in equals comparisons on the objects is
modified.
x, x.equals(null) should return
false.
The equals method for class Object implements the most discriminating possible
equivalence relation on objects; that is, for any non-null reference values x and
y, this method returns true if and only if x and y refer to the
same object (x == y has the value true).
Note that it is generally necessary to override the hashCode method whenever this method
is overridden, so as to maintain the general contract for the hashCode method, which
states that equal objects must have equal hash codes.
equals in class Objectother - the reference object with which to compare.true if this object is the same as the obj argument; false otherwise.Object.hashCode(),
HashMappublic final MessageType getDefaultInstanceForType()
MessageLiteOrBuildergetDefaultInstance() method of generated message classes in that this method is an abstract
method of the MessageLite interface whereas getDefaultInstance() is a static method of a specific
class. They return the same thing.public final Parser<MessageType> getParserForType()
MessageLitepublic int hashCode()
ObjectHashMap.
The general contract of hashCode is:
hashCode method must consistently return the same integer, provided no
information used in equals comparisons on the object is modified. This integer need not
remain consistent from one execution of an application to another execution of the same
application.
equals(Object) method, then calling the
hashCode method on each of the two objects must produce the same integer result.
Object.equals(java.lang.Object) method, then calling the hashCode
method on each of the two objects must produce distinct integer results. However, the programmer
should be aware that producing distinct integer results for unequal objects may improve the
performance of hash tables.
As much as is reasonably practical, the hashCode method defined by class Object does
return distinct integers for distinct objects. (This is typically implemented by converting the
internal address of the object into an integer, but this implementation technique is not required
by the JavaTM programming language.)
hashCode in class ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public final boolean isInitialized()
MessageLiteOrBuilderprotected static final <T extends GeneratedMessageLite<T,?>> boolean isInitialized(T message, boolean shouldMemoize)
For use by generated code only.
protected void makeImmutable()
protected static final <T extends GeneratedMessageLite<T,?>> void makeImmutable(T message)
protected void mergeLengthDelimitedField(int fieldNumber,
ByteString value)
protected final void mergeUnknownFields(UnknownFieldSetLite unknownFields)
UnknownFieldSetLite for this message.
For use by generated code only.
protected void mergeVarintField(int tag,
int value)
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 <E> Internal.ProtobufList<E> mutableCopy(Internal.ProtobufList<E> list)
public final BuilderType newBuilderForType()
MessageLitepublic static <ContainingType extends MessageLite,Type> GeneratedMessageLite.GeneratedExtension<ContainingType,Type> newRepeatedGeneratedExtension(ContainingType containingTypeDefaultInstance, MessageLite messageDefaultInstance, Internal.EnumLiteMap<?> enumTypeMap, int number, WireFormat.FieldType type, boolean isPacked, Class singularType)
public static <ContainingType extends MessageLite,Type> GeneratedMessageLite.GeneratedExtension<ContainingType,Type> newSingularGeneratedExtension(ContainingType containingTypeDefaultInstance, Type defaultValue, MessageLite messageDefaultInstance, Internal.EnumLiteMap<?> enumTypeMap, int number, WireFormat.FieldType type, Class singularType)
protected static <T extends GeneratedMessageLite<T,?>> T parseDelimitedFrom(T defaultInstance, InputStream input) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseDelimitedFrom(T defaultInstance, InputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, byte[] data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, ByteString data) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, CodedInputStream input) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, InputStream input) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parseFrom(T defaultInstance, InputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected static <T extends GeneratedMessageLite<T,?>> T parsePartialFrom(T defaultInstance, CodedInputStream input) throws InvalidProtocolBufferException
InvalidProtocolBufferExceptionprotected boolean parseUnknownField(int tag,
CodedInputStream input)
throws IOException
true unless the tag is an end-group tag.IOExceptionpublic final BuilderType toBuilder()
MessageLite