Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## drm.agentbase
Class Message

    java.lang.Object
      |
      +--drm.agentbase.Message

All Implemented Interfaces:
  java.io.Serializable

public class Message
extends java.lang.Object
implements java.io.Serializable

The classtype of a message that agents and bases can send to each other.

See Also:
  Serialized Form

Constructor Summary
`Message(Address sender, Address recipient, java.lang.String type)` Constructs a Message using the values of the fields.
`Message(Address sender, Address recipient, java.lang.String type, java.lang.Object object)` Constructs a Message using the values of the fields.

Method Summary
`byte[]` | `getBinary()` The binary content of the message.
`Address` | `getRecipient()` The address of the recepient.
`Address` | `getSender()` The address of the sender.
`java.lang.String` | `getType()` The type of the message.
`void` | `setReply(java.lang.Object o)` This method allows the recipient of the message to send a reply object when handling the message.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Message

    public Message(Address sender,
                   Address recipient,
                   java.lang.String type)

  Constructs a Message using the values of the fields. The binary content is set to null.

### Message

    public Message(Address sender,
                   Address recipient,
                   java.lang.String type,
                   java.lang.Object object)
            throws java.io.IOException

  Constructs a Message using the values of the fields. The binary content is initialized by serializing the given Object to a byte array. This is useful to allow delayed de-serialisation at the reception side possibly using a recepient-specific classloader.
  Parameters:
    `object` - The object to be converted to byte array. If it is null then no exception is thrown and null is set as binary content.
  Throws:
    `java.io.IOException` - If the conversion of the given object to byte array is not succesful.

Method Detail

### getSender

    public Address getSender()

  The address of the sender.

### getRecipient

    public Address getRecipient()

  The address of the recepient.

### getType

    public java.lang.String getType()

  The type of the message.

### getBinary

    public byte[] getBinary()

  The binary content of the message.

### setReply

    public void setReply(java.lang.Object o)

  This method allows the recipient of the message to send a reply object when handling the message. This object is sent back to the sender.

  The object will undergo a serialization-deserialization procedure, even if the recipient is local, just like in the case of message content. Even though this adds some overhead, the locality/non-locality of an address should normally be transparent and some implementations which send objects that reimplement write/readObject might depend on the actual algorithm of serialization.

  See Also:
    `IAgent.handleMessage(Message,Object)`, `IBase.fireMessage(Message)`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD