ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able
Class AbleMessageContainer

java.lang.Object
  |
  +--com.ibm.able.AbleMessageContainer
All Implemented Interfaces:
java.io.Serializable

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

Capture the entire context of translatable String in a distributed platform.

A platform could potentially be distributed over many different system, each with a different locale. Early binding of message could lead to confusion if it was sent to a system with a different locale. To avoid this confusion, an AbleMessageContainer can be passed around instead of a String where this problem could occur.

This will hold enough information to be able to bind the String with an appropriate message bundle at any time. If enough information is not supplied, then the current message will be used without attempting to get it to the correct language.

See Also:
Serialized Form

Constructor Summary
AbleMessageContainer(AbleMessageContainer theAbleMessageContainer)
          Creates an AbleMessageContainer from another AbleMessageContainer.
AbleMessageContainer(java.lang.String theMessage)
          Creates an AbleMessageContainer from a (possibly pre-resolved) string; this should be used when late binding is not an option but an AbleMessageContainer object is still required.
AbleMessageContainer(java.lang.String theMessageID, java.lang.Object[] theSubText, java.lang.String theResourceBundle)
          Creates an AbleMessageContainer that captures the context of a translatable message that has insertion text.
AbleMessageContainer(java.lang.String theMessageID, java.lang.String theResourceBundle)
          Creates an AbleMessageContainer that captures the context of a translatable message that has no insertion text.
 
Method Summary
static java.lang.String Copyright()
          Gets the copyright of this class.
 java.lang.String debugString()
          Returns a representation of this AbleMessageContainer.
 boolean equals(java.lang.Object o)
          Compares this AbleMessageContainer with another to determine if the reports are equal.
 java.lang.String getMessage()
          Gets the pre-stored message text when there is no resource bundle that holds the message.
 java.lang.String getMessageID()
          Gets the ID of the message to be found in the resource bundle.
 java.lang.String getResourceBundle()
          Gets the fully qualified class name of the resource bundle in which the message text is located.
 java.lang.Object[] getSubText()
          Gets insertion text, if any, to be placed in the message when the message is formatted.
 int hashcode()
          Return the hashcode for an AbleMessageContainer
 java.lang.String toString()
          Returns a brief description of this AbleMessageContainer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbleMessageContainer

public AbleMessageContainer(java.lang.String theMessageID,
                            java.lang.String theResourceBundle)
Creates an AbleMessageContainer that captures the context of a translatable message that has no insertion text.
Parameters:
theMessageID - The ID of a message to be found in a resource bundle.

theResourceBundle - The fully qualified class name of the resource bundle in which the message can be found.

AbleMessageContainer

public AbleMessageContainer(java.lang.String theMessageID,
                            java.lang.Object[] theSubText,
                            java.lang.String theResourceBundle)
Creates an AbleMessageContainer that captures the context of a translatable message that has insertion text.
Parameters:
theMessageID - The ID of a message to be found in a resource bundle.

theSubText - The substitution text for this message.
theResourceBundle - The fully qualified class name of the resource bundle in which the message can be found.


AbleMessageContainer

public AbleMessageContainer(java.lang.String theMessage)
Creates an AbleMessageContainer from a (possibly pre-resolved) string; this should be used when late binding is not an option but an AbleMessageContainer object is still required. The AbleMessageContainer contains only the message string.
Parameters:
theMessage - The message String in the language of the system this message originated on.

AbleMessageContainer

public AbleMessageContainer(AbleMessageContainer theAbleMessageContainer)
                     throws AbleException
Creates an AbleMessageContainer from another AbleMessageContainer.
Parameters:
theAbleMessageContainer - The AbleMessageContainer that is to be copied.
Method Detail

getMessageID

public java.lang.String getMessageID()
Gets the ID of the message to be found in the resource bundle.
Returns:
The message ID.

getSubText

public java.lang.Object[] getSubText()
Gets insertion text, if any, to be placed in the message when the message is formatted.
Returns:
The substitution text, or null if the message does not use substitution text.

getResourceBundle

public java.lang.String getResourceBundle()
Gets the fully qualified class name of the resource bundle in which the message text is located.
Returns:
The fully qualified class name of the resource bundle.

getMessage

public java.lang.String getMessage()
Gets the pre-stored message text when there is no resource bundle that holds the message.
Returns:
The message text.

Copyright

public static java.lang.String Copyright()
Gets the copyright of this class.

Returns:
A string containing this class's copyright statement.

debugString

public java.lang.String debugString()
Returns a representation of this AbleMessageContainer.

Returns:
The representation of this AbleMessageContainer.

equals

public boolean equals(java.lang.Object o)
Compares this AbleMessageContainer with another to determine if the reports are equal.

AbleMessageContainers are equal if their internal, private, immutable handles are equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - An instance of an AbleMessageContainer that is to be compared to this AbleMessageContainer.

Returns:
true, if this AbleMessageContainer is equal to the specified AbleMessageContainer; false, otherwise.

AbleMessageContainers are equal if all their internal, private, immutable data members are equal.


hashcode

public int hashcode()
Return the hashcode for an AbleMessageContainer

The hashcode of AbleMessageContainers is the sum of the hashcodes of all of the the internal, private, immutable handles of this Object.

Returns:
The sum of the hashcodes of all of the internal, private, immutable data members are equal.

toString

public java.lang.String toString()
Returns a brief description of this AbleMessageContainer.

If the AbleMessageContainer was meant to be translated, the message ID that is to be used is returned.

If the AbleMessageContainer was not meant to be translated, then just the message is returned.

Overrides:
toString in class java.lang.Object
Returns:
A brief description of this AbleMessageContainer.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003