org.apache.commons.i18n.bundles
Class TextBundle
java.lang.Object
org.apache.commons.i18n.LocalizedBundle
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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEXT
public static final java.lang.String TEXT
- See Also:
- Constant Field Values
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 messagemessageId
- 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 messagearguments
- 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 messagemessageId
- Unique message id that identifies the messagearguments
- An array of objects conaining the values that should be
inserted into the localized message.
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 textdefaultText
- 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.