# Class AbstractReplicatedMap.MapMessage

java.lang.Object
org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapMessage

All Implemented Interfaces:
  `Serializable, Cloneable`

Enclosing class:
  `AbstractReplicatedMap<K,V>`

public static class AbstractReplicatedMap.MapMessage extends Object implements Serializable, Cloneable
Represents a message sent between replicated map instances.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`MSG_ACCESS`
Message type: access.
`static final int`
`MSG_BACKUP`
Message type: backup.
`static final int`
`MSG_COPY`
Message type: copy.
`static final int`
`MSG_INIT`
Message type: init.
`static final int`
`MSG_NOTIFY_MAPMEMBER`
Message type: notify map member.
`static final int`
`MSG_PING`
Message type: ping.
`static final int`
`MSG_PROXY`
Message type: proxy.
`static final int`
`MSG_REMOVE`
Message type: remove.
`static final int`
`MSG_RETRIEVE_BACKUP`
Message type: retrieve backup.
`static final int`
`MSG_START`
Message type: start.
`static final int`
`MSG_STATE`
Message type: state.
`static final int`
`MSG_STATE_COPY`
Message type: state copy.
`static final int`
`MSG_STOP`
Message type: stop.

## Constructor Summary

Constructors
Constructor
Description
`MapMessage(byte[] mapId, int msgtype, boolean diff, Serializable key, Serializable value, byte[] diffvalue, Member primary, Member[] nodes)`
Creates a new map message with the specified parameters.

## Method Summary

Modifier and Type
Method
Description
`AbstractReplicatedMap.MapMessage`
`clone()`
Creates a shallow copy of this map message.
`void`
`deserialize(ClassLoader[] cls)`
Deserializes the key and value using the given class loaders.
`Member[]`
`getBackupNodes()`
Gets the backup nodes.
`byte[]`
`getDiffValue()`
Gets the diff value data.
`Serializable`
`getKey()`
Gets the key for this message.
`byte[]`
`getKeyData()`
Gets the serialized key data.
`byte[]`
`getMapId()`
Gets the map identifier.
`int`
`getMsgType()`
Gets the message type.
`Member`
`getPrimary()`
Gets the primary member.
`String`
`getTypeDesc()`
Gets a description of the message type.
`Serializable`
`getValue()`
Gets the value for this message.
`byte[]`
`getValueData()`
Gets the serialized value data.
`boolean`
`isDiff()`
Checks if this is a diff message.
`Serializable`
`key(ClassLoader[] cls)`
Deserializes the key using the given class loaders.
`void`
`setKey(Serializable key)`
Sets the key for this message.
`void`
`setValue(Serializable value)`
Sets the value for this message.
`String`
`toString()`
Returns a string representation of this map message.
`Serializable`
`value(ClassLoader[] cls)`
Deserializes the value using the given class loaders.

### Methods inherited from class Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### MSG_BACKUP

public static final int MSG_BACKUP
Message type: backup.

See Also:
  - Constant Field Values

### MSG_RETRIEVE_BACKUP

public static final int MSG_RETRIEVE_BACKUP
Message type: retrieve backup.

See Also:
  - Constant Field Values

### MSG_PROXY

public static final int MSG_PROXY
Message type: proxy.

See Also:
  - Constant Field Values

### MSG_REMOVE

public static final int MSG_REMOVE
Message type: remove.

See Also:
  - Constant Field Values

### MSG_STATE

public static final int MSG_STATE
Message type: state.

See Also:
  - Constant Field Values

### MSG_START

public static final int MSG_START
Message type: start.

See Also:
  - Constant Field Values

### MSG_STOP

public static final int MSG_STOP
Message type: stop.

See Also:
  - Constant Field Values

### MSG_INIT

public static final int MSG_INIT
Message type: init.

See Also:
  - Constant Field Values

### MSG_COPY

public static final int MSG_COPY
Message type: copy.

See Also:
  - Constant Field Values

### MSG_STATE_COPY

public static final int MSG_STATE_COPY
Message type: state copy.

See Also:
  - Constant Field Values

### MSG_ACCESS

public static final int MSG_ACCESS
Message type: access.

See Also:
  - Constant Field Values

### MSG_NOTIFY_MAPMEMBER

public static final int MSG_NOTIFY_MAPMEMBER
Message type: notify map member.

See Also:
  - Constant Field Values

### MSG_PING

public static final int MSG_PING
Message type: ping.

See Also:
  - Constant Field Values

## Constructor Details

### MapMessage

public MapMessage(byte[] mapId, int msgtype, boolean diff, Serializable key, Serializable value, byte[] diffvalue, Member primary, Member[] nodes)
Creates a new map message with the specified parameters.

Parameters:
  `mapId` - The map identifier
  `msgtype` - The message type
  `diff` - Whether this is a diff message
  `key` - The key
  `value` - The value
  `diffvalue` - The serialized diff value
  `primary` - The primary member
  `nodes` - The backup nodes

## Method Details

### toString

public String toString()
Returns a string representation of this map message.

Overrides:
  `toString` in class `Object`
Returns:
  a string representation of this map message

### getTypeDesc

public String getTypeDesc()
Gets a description of the message type.

Returns:
  A string description of the message type

### deserialize

public void deserialize(ClassLoader[] cls) throws IOException, ClassNotFoundException
Deserializes the key and value using the given class loaders.

Parameters:
  `cls` - The class loaders to use for deserialization
Throws:
  `IOException` - If deserialization fails
  `ClassNotFoundException` - If a class is not found

### getMsgType

public int getMsgType()
Gets the message type.

Returns:
  the message type

### isDiff

public boolean isDiff()
Checks if this is a diff message.

Returns:
  `true` if this is a diff message

### getKey

public Serializable getKey()
Gets the key for this message.

Returns:
  The key

### key

public Serializable key(ClassLoader[] cls) throws IOException, ClassNotFoundException
Deserializes the key using the given class loaders.

Parameters:
  `cls` - The class loaders to use for deserialization
Returns:
  The deserialized key
Throws:
  `IOException` - If deserialization fails
  `ClassNotFoundException` - If the key class is not found

### getKeyData

public byte[] getKeyData()
Gets the serialized key data.

Returns:
  The serialized key data

### getValue

public Serializable getValue()
Gets the value for this message.

Returns:
  The value

### value

public Serializable value(ClassLoader[] cls) throws IOException, ClassNotFoundException
Deserializes the value using the given class loaders.

Parameters:
  `cls` - The class loaders to use for deserialization
Returns:
  The deserialized value
Throws:
  `IOException` - If deserialization fails
  `ClassNotFoundException` - If the value class is not found

### getValueData

public byte[] getValueData()
Gets the serialized value data.

Returns:
  The serialized value data

### getDiffValue

public byte[] getDiffValue()
Gets the diff value data.

Returns:
  The diff value data

### getBackupNodes

public Member[] getBackupNodes()
Gets the backup nodes.

Returns:
  The backup nodes

### getPrimary

public Member getPrimary()
Gets the primary member.

Returns:
  The primary member

### getMapId

public byte[] getMapId()
Gets the map identifier.

Returns:
  the map identifier

### setValue

public void setValue(Serializable value)
Sets the value for this message.

Parameters:
  `value` - The value

### setKey

public void setKey(Serializable key)
Sets the key for this message.

Parameters:
  `key` - The key

### clone

public AbstractReplicatedMap.MapMessage clone()
Creates a shallow copy of this map message.

Overrides:
  `clone` in class `Object`
Returns:
  a shallow copy of this map message