public abstract class AbstractMessage extends AbstractMessageLite implements Message
A partial implementation of the Message interface which implements as many methods of
that interface as possible in terms of other methods.
Static Methods
hashBoolean(boolean b) (deprecated)
protected static int hashBoolean(boolean b)
Deprecated. from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
generated code.
Parameter
Returns
hashEnum(Internal.EnumLite e) (deprecated)
protected static int hashEnum(Internal.EnumLite e)
Deprecated. from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
generated code.
Parameter
Returns
hashEnumList(List<? extends Internal.EnumLite> list) (deprecated)
protected static int hashEnumList(List<? extends Internal.EnumLite> list)
Deprecated. from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
generated code.
Parameter
Name | Description |
list | List<? extends com.google.protobuf.Internal.EnumLite>
|
Returns
hashFields(int hash, Map<Descriptors.FieldDescriptor,Object> map)
protected static int hashFields(int hash, Map<Descriptors.FieldDescriptor,Object> map)
Get a hash code for given fields and values, using the given seed.
Parameters
Returns
hashLong(long n) (deprecated)
protected static int hashLong(long n)
Deprecated. from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
generated code.
Parameter
Returns
Constructors
AbstractMessage()
Fields
memoizedSize
protected int memoizedSize
Field Value
Methods
equals(Object other)
public boolean equals(Object other)
Compares the specified object with this message for equality. Returns true
if the given
object is a message of the same type (as defined by getDescriptorForType()
) and has
identical values for all of its fields. Subclasses must implement this; inheriting
Object.equals()
is incorrect.
Parameter
Returns
Overrides
findInitializationErrors()
public List<String> findInitializationErrors()
Returns a list of field paths (e.g. "foo.bar.baz") of required fields which are not set in this
message. You should call MessageLiteOrBuilder#isInitialized() first to check if there
are any missing fields, as that method is likely to be much faster than this one even when the
message is fully-initialized.
Returns
getInitializationErrorString()
public String getInitializationErrorString()
Returns a comma-delimited list of required fields which are not set in this message object. You
should call MessageLiteOrBuilder#isInitialized() first to check if there are any
missing fields, as that method is likely to be much faster than this one even when the message
is fully-initialized.
Returns
getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
public Descriptors.FieldDescriptor getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
TODO(jieluo): Clear it when all subclasses have implemented this method.
Parameter
Returns
getSerializedSize()
public int getSerializedSize()
Get the number of bytes required to encode this message. The result is only computed on the
first call and memoized after that.
If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will
be smaller than the actual number of bytes required and might be negative.
Returns
hasOneof(Descriptors.OneofDescriptor oneof)
public boolean hasOneof(Descriptors.OneofDescriptor oneof)
TODO(jieluo): Clear it when all subclasses have implemented this method.
Parameter
Returns
hashCode()
Returns the hash code value for this message. The hash code of a message should mix the
message's type (object identity of the descriptor) with its contents (known and unknown field
values). Subclasses must implement this; inheriting Object.hashCode()
is incorrect.
Returns
Overrides
isInitialized()
public boolean isInitialized()
Returns
newBuilderForType(AbstractMessage.BuilderParent parent)
protected Message.Builder newBuilderForType(AbstractMessage.BuilderParent parent)
Parameter
Returns
toString()
public final String toString()
Returns
Overrides
writeTo(CodedOutputStream output)
public void writeTo(CodedOutputStream output)
Serializes the message and writes it to output
. This does not flush or close the
stream.
Parameter
Exceptions