org.jdtaus.core.text
Class Message

java.lang.Object
  extended by org.jdtaus.core.text.Message
All Implemented Interfaces:
Serializable, Cloneable

public abstract class Message
extends Object
implements Cloneable, Serializable

Application message.

Application messages consist of at least the two properties timestamp and formatArguments. The timestamp property will be initialized during instantiation to hold the timestamp of instance creation. Property formatArguments holds the arguments to use for formatting message text. It is recommended that subclasses of this class are declared final so that calling getClass() on a message instance always returns a type uniquely identifying a message type in the system.

Version:
$Id: Message.java 8044 2009-07-02 01:29:05Z schulte2005 $
Author:
Christian Schulte
See Also:
MessageEvent, Serialized Form

Field Summary
static Comparator ASCENDING
          Comparator for sorting messages in ascending order of occurence.
static Comparator DESCENDING
          Comparator for sorting messages in descending order of occurence.
 
Constructor Summary
Message()
          Creates a new Message instance.
 
Method Summary
 Object clone()
          Creates and returns a copy of this object.
 boolean equals(Object o)
          Indicates whether some other object is equal to this one.
abstract  Object[] getFormatArguments(Locale locale)
          Getter for property formatArguments.
abstract  String getText(Locale locale)
          Gets the formatted message text.
 long getTimestamp()
          Getter for property timestamp.
 int hashCode()
          Returns a hash code value for this object.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ASCENDING

public static final Comparator ASCENDING
Comparator for sorting messages in ascending order of occurence.

Note:
This comparator imposes orderings that are inconsistent with equals.


DESCENDING

public static final Comparator DESCENDING
Comparator for sorting messages in descending order of occurence.

Note:
This comparator imposes orderings that are inconsistent with equals.

Constructor Detail

Message

public Message()
Creates a new Message instance.

Method Detail

clone

public Object clone()
Creates and returns a copy of this object.

Overrides:
clone in class Object
Returns:
a clone of this instance.

equals

public final boolean equals(Object o)
Indicates whether some other object is equal to this one.

Messages internally cary a UID which is created during instantiation. This UID is used for comparing o with the instance.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as o; false otherwise.
See Also:
UID

getFormatArguments

public abstract Object[] getFormatArguments(Locale locale)
Getter for property formatArguments.

Parameters:
locale - the locale to be used for the arguments to return.
Returns:
the arguments to use when formatting the message text.

getText

public abstract String getText(Locale locale)
Gets the formatted message text.

Parameters:
locale - the locale to be used for the text to return.
Returns:
the text of the message for locale.

getTimestamp

public final long getTimestamp()
Getter for property timestamp.

Returns:
the timestamp this message got created.

hashCode

public final int hashCode()
Returns a hash code value for this object.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.


Copyright © 2005-2009 jDTAUS. All Rights Reserved.