# Interface Message (3.19.4)

    public interface Message extends MessageLite, MessageOrBuilder

Abstract interface implemented by Protocol Message objects.

See also [MessageLite](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageLite), which defines most of the methods that typical users care about.
Message adds to it methods that are not available in the "lite" runtime. The biggest
added features are introspection and reflection -- i.e., getting descriptors for the message type
and accessing the field values dynamically.

## Implements

[MessageLite](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageLite), [MessageOrBuilder](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder)

## Methods

### equals(Object other)

    public abstract 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** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` object to be compared for equality with this message |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | `true` if the specified object is equal to this message |

**Overrides** [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)

### getParserForType()

    public abstract Parser<? extends Message> getParserForType()

Gets the parser for a message of the same type as this message.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Parser<? extends com.google.protobuf.Message>` |   |

### hashCode()

    public abstract int 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.
**See Also:** Map#hashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | the hash code value for this message |

**Overrides** [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)

### newBuilderForType()

    public abstract Message.Builder newBuilderForType()

Constructs a new builder for a message of the same type as this message.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message.Builder` |   |

### toBuilder()

    public abstract Message.Builder toBuilder()

Constructs a builder initialized with the current message. Use this to derive a new message
from the current one.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message.Builder` |   |

### toString()

    public abstract String toString()

Converts the message to a string in protocol buffer text format. This is just a trivial wrapper
around [TextFormat.Printer#printToString(MessageOrBuilder)](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.TextFormat.Printer#com_google_protobuf_TextFormat_Printer_printToString_com_google_protobuf_MessageOrBuilder_).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)