All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class uhr.core.msg.MessageStd

java.lang.Object
   |
   +----uhr.core.tron.ConvenientStringMapStd
           |
           +----uhr.core.tron.FlexitronStd
                   |
                   +----uhr.core.msg.MessageStd

public class MessageStd
extends FlexitronStd
implements Message
This interface represents a Message that travels between parts. A Message is a special type of Datatron. It has a name (or ID) and a PropMap. The name is for symantic understanding and routing. The name is always required. Null values are allowed.


Constructor Index

 o MessageStd()
Configures the Flexitron for isElementalOnly = false, isAutoDetectDuplicateKeys = false, isNullValueAllowed = true, keySeparator = "/".
 o MessageStd(String)
Same as MessageStd() except also sets the message name.

Method Index

 o clone()
Returns a shallow copy of the object.
 o getName()
Returns the Message name.
 o reuse(String)
A convenience method for Message reuse.
 o setName(String)
Sets the Message name.
 o toString()
Returns a String representation of the name and key values.

Constructors

 o MessageStd
 public MessageStd()
Configures the Flexitron for isElementalOnly = false, isAutoDetectDuplicateKeys = false, isNullValueAllowed = true, keySeparator = "/". Later no ordered keys so lightweight.

 o MessageStd
 public MessageStd(String name)
Same as MessageStd() except also sets the message name.

Parameters:
the - name of the message.

Methods

 o toString
 public String toString()
Returns a String representation of the name and key values.

Returns:
the String representation.
Overrides:
toString in class FlexitronStd
 o clone
 public Object clone()
Returns a shallow copy of the object.

Returns:
the shallow copy of the object.
Overrides:
clone in class Object
 o setName
 public void setName(String name)
Sets the Message name. Period separators are encouraged for large systems. Spaces, slashes, semi-colons etc are not allowed.

Note the name must not only semantically describe the Message, but must be unique among all the other Messages in the portion of a system the Message will be used in. When coding names be very careful to avoid spelin mistakkes. :-) The name is case sensitive.

Due to String interning, do NOT use new String("ThisName") or String computation to create Message names. This may cause "==" to fail and is wasteful. Use literals or intern() to create reliable names. See "The Java Language Specification" section 3.10.5 on String Literals.

To prevent accidents the name is interned anyhow. :-)

Parameters:
name - the name of the Message.
 o getName
 public String getName()
Returns the Message name. This is used by MessageReceivers for determining what to do, in a manner similar to method names.

For speed and code conciseness you can assume the name has been interned, if the name was set with a literal. As of Java 1.1 all String literals seem to be reliably automatically interned. In Java 1.0 we had to have Message.setName(String) do intern() for reliability.

Returns:
the interned name.
 o reuse
 public void reuse(String name)
A convenience method for Message reuse. It does a setName() and a removeAll() in a slightly faster manner than two separate method calls. In future versions it may do more.

Parameters:
name - the name of the Message.

All Packages  Class Hierarchy  This Package  Previous  Next  Index