com.pepper.platform.i18n
Class MessageCatalog

java.lang.Object
  extended by com.pepper.platform.i18n.MessageCatalog
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CommonStrings

public class MessageCatalog
extends Object
implements Serializable

Text catalog keyed by String for internationalized messages

See Also:
Serialized Form

Constructor Summary
MessageCatalog(String name, ClassLoader classLoader)
          Creates a new instance of MessageCatalog using the given parameters.
 
Method Summary
 String getMessage(String key, int arg1)
          Returns the message catalog string associated with the given key; arg1 is converted to a string and substituted for the first parameter of the message.
 String getMessage(String key, int arg1, int arg2)
          Returns the message catalog string associated with the given key; arg1 and arg2 are converted to strings and substituted for the first two parameters of the message.
 String getMessage(String key, Object arg1)
          Returns the message catalog string associated with the given key; arg1 is converted to a string and substituted for the first parameter of the message.
 String getMessage(String key, Object[] args)
          Returns the message catalog string associated with the given key; the contents of the args array are converted to strings and substituted for the corresponding parameters of the message.
 String getMessage(String key, Object arg1, Object arg2)
          Returns the message catalog string associated with the given key; arg1 and arg2 are converted to strings and substituted for the first two parameters of the message.
 String getMessage(String key, Object arg1, Object arg2, Object arg3)
          Returns the message catalog string associated with the given key; the argN paramaters are converted to strings and substituted for the first N parameters of the message.
 String getMessage(String key, Object arg1, Object arg2, Object arg3, Object arg4)
          Returns the message catalog string associated with the given key; the argN paramaters are converted to strings and substituted for the first N parameters of the message.
 String getMessage(String key, String argList)
          Returns a string based on the key and using the supplied arguments
 String getName()
          Gets the name attribute of the CatalogI18n object.
 String getString(String key)
          Returns the message catalog string associated with the given key.
 String getString(String key, String defaultValue)
          Returns the message catalog string associated with the given key; if the specified message is not found, then the default value parameter is returned.
 void setParent(MessageCatalog parent)
          Set the parent catalog of this message catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageCatalog

public MessageCatalog(String name,
                      ClassLoader classLoader)
               throws MissingResourceException
Creates a new instance of MessageCatalog using the given parameters.

Parameters:
name - the name of the properties file to load.
classLoader - the ClassLoader to use to try to load bundle.
Throws:
MissingResourceException - Description of the failure.
Method Detail

setParent

public void setParent(MessageCatalog parent)
Set the parent catalog of this message catalog.

Parameters:
parent - Parent MessageCatalog instance

getString

public String getString(String key)
Returns the message catalog string associated with the given key.

Parameters:
key - a String specifying a message catalog key.
Returns:
A String containing the specified message.

getMessage

public String getMessage(String key,
                         String argList)
Returns a string based on the key and using the supplied arguments

Parameters:
key - a String specifying a message catalog key.
argList - a Comma separated string of args to substitute
Returns:
A String containing the specified message.

getString

public String getString(String key,
                        String defaultValue)
Returns the message catalog string associated with the given key; if the specified message is not found, then the default value parameter is returned.

Parameters:
key - a String specifying a message catalog key.
defaultValue - a String specifying a default message value.
Returns:
A String containing the specified message, or the the default value parameter if the message is not found.

getMessage

public String getMessage(String key,
                         Object arg1)
Returns the message catalog string associated with the given key; arg1 is converted to a string and substituted for the first parameter of the message.

Parameters:
key - a String specifying a message catalog key.
arg1 - an Object which is converted to a String and substitued for the first parameter of the message.
Returns:
A String containing the specified message.

getMessage

public String getMessage(String key,
                         Object arg1,
                         Object arg2)
Returns the message catalog string associated with the given key; arg1 and arg2 are converted to strings and substituted for the first two parameters of the message.

Parameters:
key - a String specifying a message catalog key.
arg1 - an Object which is converted to a String and substitued for the first parameter of the message.
arg2 - an Object which is converted to a String and substitued for the second parameter of the message.
Returns:
A String containing the specified message.

getMessage

public String getMessage(String key,
                         Object arg1,
                         Object arg2,
                         Object arg3)
Returns the message catalog string associated with the given key; the argN paramaters are converted to strings and substituted for the first N parameters of the message.

Parameters:
key - a String specifying a message catalog key.
arg1 - an Object which is converted to a String and substitued for the first parameter of the message.
arg2 - an Object which is converted to a String and substitued for the second parameter of the message.
arg3 - an Object which is converted to a String and substitued for the third parameter of the message.
Returns:
A String containing the specified message.

getMessage

public String getMessage(String key,
                         Object arg1,
                         Object arg2,
                         Object arg3,
                         Object arg4)
Returns the message catalog string associated with the given key; the argN paramaters are converted to strings and substituted for the first N parameters of the message.

Parameters:
key - a String specifying a message catalog key.
arg1 - an Object which is converted to a String and substitued for the first parameter of the message.
arg2 - an Object which is converted to a String and substitued for the second parameter of the message.
arg3 - an Object which is converted to a String and substitued for the third parameter of the message.
arg4 - an Object which is converted to a String and substitued for the fourth parameter of the message.
Returns:
A String containing the specified message.

getMessage

public String getMessage(String key,
                         int arg1)
Returns the message catalog string associated with the given key; arg1 is converted to a string and substituted for the first parameter of the message.

Parameters:
key - a String specifying a message catalog key.
arg1 - an int which is converted to a String and substitued for the first parameter of the message.
Returns:
A String containing the specified message.

getMessage

public String getMessage(String key,
                         int arg1,
                         int arg2)
Returns the message catalog string associated with the given key; arg1 and arg2 are converted to strings and substituted for the first two parameters of the message.

Parameters:
key - a String specifying a message catalog key.
arg1 - an int which is converted to a String and substitued for the first parameter of the message.
arg2 - an int which is converted to a String and substitued for the second parameter of the message.
Returns:
A String containing the specified message.

getMessage

public String getMessage(String key,
                         Object[] args)
Returns the message catalog string associated with the given key; the contents of the args array are converted to strings and substituted for the corresponding parameters of the message.

Parameters:
key - a String specifying a message catalog key.
args - an Object array; each entry in the array is converted to a String and substitued for the corresponding message parameters.
Returns:
A String containing the specified message.

getName

public String getName()
Gets the name attribute of the CatalogI18n object.

Returns:
A String containing the name of the catalog.


Copyright © 2006-2007 Pepper Computer, Inc. All Rights Reserved.