org.apache.commons.i18n.bundles
Class TextBundle

java.lang.Object
  extended by org.apache.commons.i18n.LocalizedBundle
      extended by org.apache.commons.i18n.bundles.TextBundle
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MessageBundle

public class TextBundle
extends LocalizedBundle

The TextBundle represents the most simple localized bundle with just one single entry. Use this class if you want to deal with simple localized strings that may contain dynamic elements.

See Also:
Serialized Form

Field Summary
static java.lang.String TEXT
           
 
Fields inherited from class org.apache.commons.i18n.LocalizedBundle
arguments, id, ID, providerId
 
Constructor Summary
TextBundle(java.lang.String messageId)
           
TextBundle(java.lang.String messageId, java.lang.Object[] arguments)
           
TextBundle(java.lang.String providerId, java.lang.String messageId)
           
TextBundle(java.lang.String providerId, java.lang.String messageId, java.lang.Object[] arguments)
           
 
Method Summary
 java.lang.String getText(java.util.Locale locale)
           
 java.lang.String getText(java.util.Locale locale, java.lang.String defaultText)
           
 
Methods inherited from class org.apache.commons.i18n.LocalizedBundle
getArguments, getEntry, getEntry, getId, getProviderId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT

public static final java.lang.String TEXT
See Also:
Constant Field Values
Constructor Detail

TextBundle

public TextBundle(java.lang.String messageId)
Parameters:
messageId - Unique message id that identifies the message

TextBundle

public TextBundle(java.lang.String providerId,
                  java.lang.String messageId)
Parameters:
providerId - The name of the message provider (i.e. source) to use for the message
messageId - Unique message id that identifies the message

TextBundle

public TextBundle(java.lang.String messageId,
                  java.lang.Object[] arguments)
Parameters:
messageId - Unique message id that identifies the message
arguments - An array of objects conaining the values that should be inserted into the localized message.

TextBundle

public TextBundle(java.lang.String providerId,
                  java.lang.String messageId,
                  java.lang.Object[] arguments)
Parameters:
providerId - The name of the message provider (i.e. source) to use for the message
messageId - Unique message id that identifies the message
arguments - An array of objects conaining the values that should be inserted into the localized message.
Method Detail

getText

public java.lang.String getText(java.util.Locale locale)
                         throws MessageNotFoundException
Parameters:
locale - The locale that is used to find the appropriate localized text
Returns:
returns the localized message entry with the key text
Throws:
MessageNotFoundException - is thrown if no entry with key text could be found in the message bundle identified by the given message identifier

getText

public java.lang.String getText(java.util.Locale locale,
                                java.lang.String defaultText)
Parameters:
locale - The locale that is used to find the appropriate localized text
defaultText - The default text will be returned, if no entry with key text could be found in the message bundle identified by the given message identifier
Returns:
returns the localized message entry with the key text


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