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 theMessageinterface which implements as many methods of that interface as possible in terms of other methods.Users should generally ignore this class and use the Message interface instead.
This class is intended to only be extended by protoc created gencode. It is not intended or supported to extend this class, and any protected methods may be removed without it being considered a breaking change as long as all supported gencode does not depend on the changed methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractMessage.Builder<BuilderType extends AbstractMessage.Builder<BuilderType>>A partial implementation of theMessage.Builderinterface which implements as many methods of that interface as possible in terms of other methods.protected static interfaceAbstractMessage.BuilderParentInterface for the parent of a Builder that allows the builder to communicate invalidations back to the parent for use when using nested builders.
-
Field Summary
Fields Modifier and Type Field Description protected intmemoizedSize
-
Constructor Summary
Constructors Constructor Description AbstractMessage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)Compares the specified object with this message for equality.java.util.List<java.lang.String>findInitializationErrors()Returns a list of field paths (e.g.java.lang.StringgetInitializationErrorString()Returns a comma-delimited list of required fields which are not set in this message object.Descriptors.FieldDescriptorgetOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)Obtains the FieldDescriptor if the given oneof is set.intgetSerializedSize()inthashCode()Returns the hash code value for this message.protected static inthashFields(int hash, java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> map)Get a hash code for given fields and values, using the given seed.booleanhasOneof(Descriptors.OneofDescriptor oneof)Returns true if the given oneof is set.booleanisInitialized()protected Message.BuildernewBuilderForType(AbstractMessage.BuilderParent parent)Create a nested builder.java.lang.StringtoString()Converts the message to a string in protocol buffer text format.voidwriteTo(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
-
-
-
-
Method Detail
-
isInitialized
public boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder
-
newBuilderForType
protected Message.Builder newBuilderForType(AbstractMessage.BuilderParent parent)
Create a nested builder.
-
findInitializationErrors
public java.util.List<java.lang.String> findInitializationErrors()
Description copied from interface:MessageOrBuilderReturns 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:
findInitializationErrorsin interfaceMessageOrBuilder
-
getInitializationErrorString
public java.lang.String getInitializationErrorString()
Description copied from interface:MessageOrBuilderReturns 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:
getInitializationErrorStringin interfaceMessageOrBuilder
-
hasOneof
public boolean hasOneof(Descriptors.OneofDescriptor oneof)
Description copied from interface:MessageOrBuilderReturns true if the given oneof is set.- Specified by:
hasOneofin interfaceMessageOrBuilder
-
getOneofFieldDescriptor
public Descriptors.FieldDescriptor getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
Description copied from interface:MessageOrBuilderObtains the FieldDescriptor if the given oneof is set. Returns null if no field is set.- Specified by:
getOneofFieldDescriptorin interfaceMessageOrBuilder
-
toString
public final java.lang.String toString()
Description copied from interface:MessageConverts the message to a string in protocol buffer text format. This is just a trivial wrapper aroundTextFormat.Printer.printToString(MessageOrBuilder).
-
writeTo
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException- Specified by:
writeToin interfacecom.google.protobuf.MessageLite- Throws:
java.io.IOException
-
getSerializedSize
public int getSerializedSize()
- Specified by:
getSerializedSizein interfacecom.google.protobuf.MessageLite
-
equals
public boolean equals(java.lang.Object other)
Description copied from interface:MessageCompares the specified object with this message for equality. Returnstrueif 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:MessageReturns 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
protected static int hashFields(int hash, java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> map)Get a hash code for given fields and values, using the given seed.
-
-