Package com.google.protobuf
Class AbstractMessage
java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
- All Implemented Interfaces:
Message
,com.google.protobuf.MessageLite
,com.google.protobuf.MessageLiteOrBuilder
,MessageOrBuilder
- Direct Known Subclasses:
DynamicMessage
,GeneratedMessage
,MapEntry
public abstract class AbstractMessage
extends com.google.protobuf.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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A partial implementation of theMessage.Builder
interface which implements as many methods of that interface as possible in terms of other methods.protected static interface
Interface for the parent of a Builder that allows the builder to communicate invalidations back to the parent for use when using nested builders.Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessageLite.InternalOneOfEnum
-
Field Summary
FieldsFields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the specified object with this message for equality.Returns a list of field paths (e.g.Returns a comma-delimited list of required fields which are not set in this message object.Obtains the FieldDescriptor if the given oneof is set.int
int
hashCode()
Returns the hash code value for this message.protected static int
hashFields
(int hash, Map<Descriptors.FieldDescriptor, Object> map) Get a hash code for given fields and values, using the given seed.boolean
Returns true if the given oneof is set.boolean
protected Message.Builder
Create a nested builder.final String
toString()
Converts the message to a string in protocol buffer text format.void
writeTo
(com.google.protobuf.CodedOutputStream output) Methods inherited from class com.google.protobuf.AbstractMessageLite
addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.protobuf.Message
getParserForType, newBuilderForType, toBuilder
Methods inherited from interface com.google.protobuf.MessageLite
toByteArray, toByteString, writeDelimitedTo, writeTo
Methods inherited from interface com.google.protobuf.MessageOrBuilder
getAllFields, getDefaultInstanceForType, getDescriptorForType, getField, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField
-
Field Details
-
memoizedSize
protected int memoizedSize
-
-
Constructor Details
-
AbstractMessage
public AbstractMessage()
-
-
Method Details
-
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
-
newBuilderForType
Create a nested builder. -
findInitializationErrors
Description copied from interface:MessageOrBuilder
Returns a list of field paths (e.g. "foo.bar.baz") of required fields which are not set in this message. You should callMessageLiteOrBuilder.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.- Specified by:
findInitializationErrors
in interfaceMessageOrBuilder
-
getInitializationErrorString
Description copied from interface:MessageOrBuilder
Returns a comma-delimited list of required fields which are not set in this message object. You should callMessageLiteOrBuilder.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.- Specified by:
getInitializationErrorString
in interfaceMessageOrBuilder
-
hasOneof
Description copied from interface:MessageOrBuilder
Returns true if the given oneof is set.- Specified by:
hasOneof
in interfaceMessageOrBuilder
-
getOneofFieldDescriptor
Description copied from interface:MessageOrBuilder
Obtains the FieldDescriptor if the given oneof is set. Returns null if no field is set.- Specified by:
getOneofFieldDescriptor
in interfaceMessageOrBuilder
-
toString
Description copied from interface:Message
Converts the message to a string in protocol buffer text format. This is just a trivial wrapper aroundTextFormat.Printer.printToString(MessageOrBuilder)
. -
writeTo
- Specified by:
writeTo
in interfacecom.google.protobuf.MessageLite
- Throws:
IOException
-
getSerializedSize
public int getSerializedSize()- Specified by:
getSerializedSize
in interfacecom.google.protobuf.MessageLite
-
equals
Description copied from interface:Message
Compares the specified object with this message for equality. Returnstrue
if the given object is a message of the same type (as defined bygetDescriptorForType()
) and has identical values for all of its fields. Subclasses must implement this; inheritingObject.equals()
is incorrect. -
hashCode
public int hashCode()Description copied from interface:Message
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; inheritingObject.hashCode()
is incorrect. -
hashFields
Get a hash code for given fields and values, using the given seed.
-