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.
-
arg
- An arbitrary argument.
-
CLONE
- These kinds are used to specify the priority of the system message
-
DEACTIVATE
-
-
DISPATCH
-
-
DISPOSE
-
-
kind
- The kind of the message.
-
REVERT
-
-
timestamp
- The time when the message was sent.
-
Message(String)
- Constructs a message.
-
Message(String, boolean)
- Constructs a message with an argument value.
-
Message(String, char)
- Constructs a message with an argument value.
-
Message(String, double)
- Constructs a message with an argument value.
-
Message(String, float)
- Constructs a message with an argument value.
-
Message(String, int)
- Constructs a message with an argument value.
-
Message(String, long)
- Constructs a message with an argument value.
-
Message(String, Object)
- Constructs a message with an argument value.
-
equals(Object)
- Compares two Message objects.
-
getArg()
- Gets the argument
-
getArg(String)
- Gets an argument value
-
getKind()
- Gets the kind of this message
-
getTimeStamp()
- Gets the time in milliseconds when the message was sent.
-
sameKind(String)
- Checks if the message has same kind as given string.
-
sendException(Exception)
- Sets a exception to this message.
-
sendReply()
- Send a reply without sepcific value.
-
sendReply(boolean)
- Sends a bolean value as a reply
-
sendReply(char)
- Sends a character value as a reply
-
sendReply(double)
- Sends a double value as a reply
-
sendReply(float)
- Sends a float value as a reply
-
sendReply(int)
- Sends a integer value as a reply
-
sendReply(long)
- Sends a long value as a reply
-
sendReply(Object)
- Sets a reply to this message.
-
setArg(String, Object)
- Sets an argument value with associated name.
-
toString()
-
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.
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.
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.
CLONE
public final static String CLONE
- These kinds are used to specify the priority of the system message
- See Also:
- setPriority
DISPATCH
public final static String DISPATCH
DISPOSE
public final static String DISPOSE
DEACTIVATE
public final static String DEACTIVATE
REVERT
public final static String REVERT
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
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
Message
public Message(String kind,
int i)
- Constructs a message with an argument value.
- Parameters:
- kind - a kind of this message
Message
public Message(String kind,
double d)
- Constructs a message with an argument value.
- Parameters:
- kind - a kind of this message
Message
public Message(String kind,
float f)
- Constructs a message with an argument value.
- Parameters:
- kind - a kind of this message
Message
public Message(String kind,
boolean b)
- Constructs a message with an argument value.
- Parameters:
- kind - a kind of this message
Message
public Message(String kind,
char c)
- Constructs a message with an argument value.
- Parameters:
- kind - a kind of this message
Message
public Message(String kind,
long l)
- Constructs a message with an argument value.
- Parameters:
- kind - a kind of this message
getKind
public String getKind()
- Gets the kind of this message
sameKind
public boolean sameKind(String k)
- Checks if the message has same kind as given string.
- Parameters:
- k - a string to compare
getTimeStamp
public long getTimeStamp()
- Gets the time in milliseconds when the message was sent.
getArg
public Object getArg()
- Gets the argument
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
getArg
public Object getArg(String name)
- Gets an argument value
- Parameters:
- name - a name of this argument
- Returns:
- a value of this argument
sendReply
public void sendReply(Object arg)
- Sets a reply to this message.
- Throws: IllegalAccessErrro
- if a reply has already been sent.
- See Also:
- getReply
sendReply
public void sendReply()
- Send a reply without sepcific value.
- Throws: IllegalAccessErrro
- if a reply has already been sent.
sendException
public void sendException(Exception exp)
- Sets a exception to this message.
- Throws: IllegalAccessErrro
- if a reply has already been sent.
sendReply
public void sendReply(int i)
- Sends a integer value as a reply
sendReply
public void sendReply(double d)
- Sends a double value as a reply
sendReply
public void sendReply(float f)
- Sends a float value as a reply
sendReply
public void sendReply(boolean b)
- Sends a bolean value as a reply
sendReply
public void sendReply(char c)
- Sends a character value as a reply
sendReply
public void sendReply(long l)
- Sends a long value as a reply
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
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index