org.apache.commons.i18n
Class LocalizedBundle

java.lang.Object
  extended byorg.apache.commons.i18n.LocalizedBundle
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
TextBundle

public class LocalizedBundle
extends Object
implements Serializable

See Also:
Serialized Form

Field Summary
protected  Object[] arguments
           
static String ARGUMENTS
           
protected  String id
           
static String ID
           
 
Constructor Summary
LocalizedBundle(String messageId)
           
LocalizedBundle(String messageId, Object[] arguments)
           
 
Method Summary
 Object[] getArguments()
           
 String getId()
           
 String getText(String key, Locale locale)
           
 String getText(String key, String defaultText, Locale locale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
See Also:
Constant Field Values

ARGUMENTS

public static final String ARGUMENTS
See Also:
Constant Field Values

id

protected String id

arguments

protected Object[] arguments
Constructor Detail

LocalizedBundle

public LocalizedBundle(String messageId)
Parameters:
messageId - The messageId refers the corresponding bundle in the file containing the localized messages. The format of the message file depends on the implementation of the MessageManager.

LocalizedBundle

public LocalizedBundle(String messageId,
                       Object[] arguments)
Parameters:
messageId - The messageId refers the corresponding bundle in the file containing the localized messages. The format of the message file depends on the implementation of the MessageManager.
arguments - An array of objects containing argument for the messages. These arguments are used to insert dynamic values into the localized messages.
Method Detail

getId

public String getId()
Returns:
returns the id of this bundle

getArguments

public Object[] getArguments()
Returns:
returns the arguments associated with this message bundle

getText

public String getText(String key,
                      Locale locale)
               throws MessageNotFoundException
Parameters:
key - the key of the specific message entry in the message bundle
locale - the locale for that this message should be rendered
Returns:
returns the localized text
Throws:
MessageNotFoundException - if an entry with the given key can not be found in this bundle

getText

public String getText(String key,
                      String defaultText,
                      Locale locale)
Parameters:
key - the key of the specific message entry in the message bundle
locale - the locale for that this message should be rendered
defaultText - the text to be returned if no entry was found for the given key
Returns:
returns the localized text


Copyright © 2004-2005 The Apache Software Foundation. All Rights Reserved.