Package com.google.protobuf
Class AbstractMessage
java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
- All Implemented Interfaces:
Message,MessageLite,MessageLiteOrBuilder,MessageOrBuilder
- Direct Known Subclasses:
DynamicMessage,GeneratedMessage
A partial implementation of the
Message interface which implements
as many methods of that interface as possible in terms of other methods.- Author:
- kenton@google.com Kenton Varda
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA partial implementation of theMessage.Builderinterface which implements as many methods of that interface as possible in terms of other methods. -
Field Summary
Fields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares 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.TODO(jieluo): Clear it when all subclasses have implemented this method.intGet the number of bytes required to encode this message.inthashCode()Returns the hash code value for this message.protected static inthashFields(int hash, Map<Descriptors.FieldDescriptor, Object> map) Get a hash code for given fields and values, using the given seed.booleanTODO(jieluo): Clear it when all subclasses have implemented this method.booleanReturns true if all required fields in the message and all embedded messages are set, false otherwise.final StringtoString()Converts the message to a string in protocol buffer text format.voidwriteTo(CodedOutputStream output) Serializes the message and writes it tooutput.Methods inherited from class com.google.protobuf.AbstractMessageLite
checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message
getParserForType, newBuilderForType, toBuilderMethods inherited from interface com.google.protobuf.MessageLite
toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from interface com.google.protobuf.MessageOrBuilder
getAllFields, getDefaultInstanceForType, getDescriptorForType, getField, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField
-
Constructor Details
-
AbstractMessage
public AbstractMessage()
-
-
Method Details
-
isInitialized
public boolean isInitialized()Description copied from interface:MessageLiteOrBuilderReturns true if all required fields in the message and all embedded messages are set, false otherwise.- Specified by:
isInitializedin interfaceMessageLiteOrBuilder
-
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
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
TODO(jieluo): Clear it when all subclasses have implemented this method.- Specified by:
hasOneofin interfaceMessageOrBuilder
-
getOneofFieldDescriptor
TODO(jieluo): Clear it when all subclasses have implemented this method.- Specified by:
getOneofFieldDescriptorin interfaceMessageOrBuilder
-
toString
Description copied from interface:MessageConverts the message to a string in protocol buffer text format. This is just a trivial wrapper aroundTextFormat.printToString(MessageOrBuilder). -
writeTo
Description copied from interface:MessageLiteSerializes the message and writes it tooutput. This does not flush or close the stream.- Specified by:
writeToin interfaceMessageLite- Throws:
IOException
-
getSerializedSize
public int getSerializedSize()Description copied from interface:MessageLiteGet the number of bytes required to encode this message. The result is only computed on the first call and memoized after that.- Specified by:
getSerializedSizein interfaceMessageLite
-
equals
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
Get a hash code for given fields and values, using the given seed.
-