com.google.protobuf
Class AbstractMessage

java.lang.Object
  extended by com.google.protobuf.AbstractMessageLite
      extended by com.google.protobuf.AbstractMessage
All Implemented Interfaces:
Message, MessageLite
Direct Known Subclasses:
DynamicMessage, GeneratedMessage

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.

Author:
[email protected] Kenton Varda

Nested Class Summary
static class AbstractMessage.Builder<BuilderType extends AbstractMessage.Builder>
          A partial implementation of the Message.Builder interface which implements as many methods of that interface as possible in terms of other methods.
 
Constructor Summary
AbstractMessage()
           
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares the specified object with this message for equality.
 int getSerializedSize()
          Get the number of bytes required to encode this message.
 int hashCode()
          Returns the hash code value for this message.
 boolean isInitialized()
          Returns true if all required fields in the message and all embedded messages are set, false otherwise.
 java.lang.String toString()
          Converts the message to a string in protocol buffer text format.
 void writeTo(CodedOutputStream output)
          Serializes the message and writes it to output.
 
Methods inherited from class com.google.protobuf.AbstractMessageLite
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
getAllFields, getDefaultInstanceForType, getDescriptorForType, getField, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, newBuilderForType, toBuilder
 
Methods inherited from interface com.google.protobuf.MessageLite
toByteArray, toByteString, writeDelimitedTo, writeTo
 

Constructor Detail

AbstractMessage

public AbstractMessage()
Method Detail

isInitialized

public boolean isInitialized()
Description copied from interface: MessageLite
Returns true if all required fields in the message and all embedded messages are set, false otherwise.

Specified by:
isInitialized in interface MessageLite

toString

public final java.lang.String toString()
Description copied from interface: Message
Converts the message to a string in protocol buffer text format. This is just a trivial wrapper around TextFormat.printToString(Message).

Specified by:
toString in interface Message
Overrides:
toString in class java.lang.Object

writeTo

public void writeTo(CodedOutputStream output)
             throws java.io.IOException
Description copied from interface: MessageLite
Serializes the message and writes it to output. This does not flush or close the stream.

Specified by:
writeTo in interface MessageLite
Throws:
java.io.IOException

getSerializedSize

public int getSerializedSize()
Description copied from interface: MessageLite
Get the number of bytes required to encode this message. The result is only computed on the first call and memoized after that.

Specified by:
getSerializedSize in interface MessageLite

equals

public boolean equals(java.lang.Object other)
Description copied from interface: Message
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.

Specified by:
equals in interface Message
Overrides:
equals in class java.lang.Object
Parameters:
other - object to be compared for equality with this message
Returns:
true if the specified object is equal to this message

hashCode

public int hashCode()
Description copied from interface: Message
Returns the hash code value for this message. The hash code of a message is defined to be getDescriptor().hashCode() ^ map.hashCode(), where map is a map of field numbers to field values.

Specified by:
hashCode in interface Message
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value for this message
See Also:
Map.hashCode()


Copyright © 2008-2010 Google. All Rights Reserved.