Class aglet.Message
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class aglet.Message

java.lang.Object
   |
   +----aglet.Message

public class Message
extends Object
implements Serializable
The Message class is a object that holds its kind and arguments passed to the receiver. In handleMessage() method on Aglet class, the reply to the request can be set if any.

Variable Index

 o arg
An arbitrary argument.
 o CLONE
These kinds are used to specify the priority of the system message
 o DEACTIVATE
 o DISPATCH
 o DISPOSE
 o kind
The kind of the message.
 o REVERT
 o timestamp
The time when the message was sent.

Constructor Index

 o Message(String)
Constructs a message.
 o Message(String, boolean)
Constructs a message with an argument value.
 o Message(String, char)
Constructs a message with an argument value.
 o Message(String, double)
Constructs a message with an argument value.
 o Message(String, float)
Constructs a message with an argument value.
 o Message(String, int)
Constructs a message with an argument value.
 o Message(String, long)
Constructs a message with an argument value.
 o Message(String, Object)
Constructs a message with an argument value.

Method Index

 o equals(Object)
Compares two Message objects.
 o getArg()
Gets the argument
 o getArg(String)
Gets an argument value
 o getKind()
Gets the kind of this message
 o getTimeStamp()
Gets the time in milliseconds when the message was sent.
 o sameKind(String)
Checks if the message has same kind as given string.
 o sendException(Exception)
Sets a exception to this message.
 o sendReply()
Send a reply without sepcific value.
 o sendReply(boolean)
Sends a bolean value as a reply
 o sendReply(char)
Sends a character value as a reply
 o sendReply(double)
Sends a double value as a reply
 o sendReply(float)
Sends a float value as a reply
 o sendReply(int)
Sends a integer value as a reply
 o sendReply(long)
Sends a long value as a reply
 o sendReply(Object)
Sets a reply to this message.
 o setArg(String, Object)
Sets an argument value with associated name.
 o toString()

Variables

 o arg
  public Object arg
An arbitrary argument. Aglet programmers should NOT use this member variable because this will be removed from public interface in the future.
 o kind
  public String kind
The kind of the message. Aglet programmers should NOT use this member variable because this will be removed from public interface in the future.
 o timestamp
  public long timestamp
The time when the message was sent. Aglet programmers should NOT use this member variable because this will be removed from public interface in the future.
 o CLONE
  public final static String CLONE
These kinds are used to specify the priority of the system message
See Also:
setPriority
 o DISPATCH
  public final static String DISPATCH
 o DISPOSE
  public final static String DISPOSE
 o DEACTIVATE
  public final static String DEACTIVATE
 o REVERT
  public final static String REVERT

Constructors

 o Message
  public Message(String kind)
Constructs a message. The message object created by this constructor have a hashtable which can be used for argument-value pair.
  Message msg = new Message("stock-price");
  msg.setArg("company", "ibm");
  msg.setArg("currency", "dallar");
  Double d = (Double) proxy.sendMessage(msg);
Parameters:
kind - a kind of this message
 o Message
  public Message(String kind,
                 Object arg)
Constructs a message with an argument value.
Parameters:
kind - a kind of this message
arg - an argument of this message
 o Message
  public Message(String kind,
                 int i)
Constructs a message with an argument value.
Parameters:
kind - a kind of this message
 o Message
  public Message(String kind,
                 double d)
Constructs a message with an argument value.
Parameters:
kind - a kind of this message
 o Message
  public Message(String kind,
                 float f)
Constructs a message with an argument value.
Parameters:
kind - a kind of this message
 o Message
  public Message(String kind,
                 boolean b)
Constructs a message with an argument value.
Parameters:
kind - a kind of this message
 o Message
  public Message(String kind,
                 char c)
Constructs a message with an argument value.
Parameters:
kind - a kind of this message
 o Message
  public Message(String kind,
                 long l)
Constructs a message with an argument value.
Parameters:
kind - a kind of this message

Methods

 o getKind
  public String getKind()
Gets the kind of this message
 o sameKind
  public boolean sameKind(String k)
Checks if the message has same kind as given string.
Parameters:
k - a string to compare
 o getTimeStamp
  public long getTimeStamp()
Gets the time in milliseconds when the message was sent.
 o getArg
  public Object getArg()
Gets the argument
 o setArg
  public void setArg(String name,
                     Object a)
Sets an argument value with associated name.
Parameters:
name - a name of this argument
a - a value of this argument
 o getArg
  public Object getArg(String name)
Gets an argument value
Parameters:
name - a name of this argument
Returns:
a value of this argument
 o sendReply
  public void sendReply(Object arg)
Sets a reply to this message.
Throws: IllegalAccessErrro
if a reply has already been sent.
See Also:
getReply
 o sendReply
  public void sendReply()
Send a reply without sepcific value.
Throws: IllegalAccessErrro
if a reply has already been sent.
 o sendException
  public void sendException(Exception exp)
Sets a exception to this message.
Throws: IllegalAccessErrro
if a reply has already been sent.
 o sendReply
  public void sendReply(int i)
Sends a integer value as a reply
 o sendReply
  public void sendReply(double d)
Sends a double value as a reply
 o sendReply
  public void sendReply(float f)
Sends a float value as a reply
 o sendReply
  public void sendReply(boolean b)
Sends a bolean value as a reply
 o sendReply
  public void sendReply(char c)
Sends a character value as a reply
 o sendReply
  public void sendReply(long l)
Sends a long value as a reply
 o equals
  public boolean equals(Object obj)
Compares two Message objects. Use sameKind() method to compare a message and a kind.
Overrides:
equals in class Object
See Also:
sameKind
 o toString
  public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index