| com.opensymphony.xwork.TextProvider
All known Subclasses: com.opensymphony.xwork.validator.CompositeTextProvider, com.opensymphony.xwork.DefaultTextProvider, com.opensymphony.xwork.ActionSupport, com.opensymphony.xwork.TextProviderSupport,
TextProvider | public interface TextProvider (Code) | | Provides access to
ResourceBundle s and their underlying text messages.
Implementing classes can delegate
TextProviderSupport . Messages will be
searched in multiple resource bundles, starting with the one associated with
this particular class (action in most cases), continuing to try the message
bundle associated with each superclass as well. It will stop once a bundle is
found that contains the given text. This gives a cascading style that allow
global texts to be defined for an application base class.
You can override
LocaleProvider.getLocale to change the behaviour of how
to choose locale for the bundles that are returned. Typically you would
use the
LocaleProvider interface to get the users configured locale.
author: Jason Carreira author: Rainer Hermanns See Also: LocaleProvider See Also: TextProviderSupport |
Method Summary | |
String | getText(String key) Gets a message based on a message key, or null if no message is found. | String | getText(String key, String defaultValue) Gets a message based on a key, or, if the message is not found, a supplied
default value is returned. | String | getText(String key, String defaultValue, String obj) Gets a message based on a key using the supplied obj, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned. | String | getText(String key, List args) Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or null if no message is found. | String | getText(String key, String[] args) Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or null if no message is found. | String | getText(String key, String defaultValue, List args) Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned. | String | getText(String key, String defaultValue, String[] args) Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned. | String | getText(String key, String defaultValue, List args, OgnlValueStack stack) Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned. | String | getText(String key, String defaultValue, String[] args, OgnlValueStack stack) Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned. | ResourceBundle | getTexts(String bundleName) Get the named bundle, such as "com/acme/Foo". | ResourceBundle | getTexts() Get the resource bundle associated with the implementing class (usually an action). | boolean | hasKey(String key) Checks if a message key exists. |
getText | String getText(String key)(Code) | | Gets a message based on a message key, or null if no message is found.
Parameters: key - the resource bundle key that is to be searched for the message as found in the resource bundle, or null if none is found. |
getText | String getText(String key, String defaultValue)(Code) | | Gets a message based on a key, or, if the message is not found, a supplied
default value is returned.
Parameters: key - the resource bundle key that is to be searched for Parameters: defaultValue - the default value which will be returned if no message is found the message as found in the resource bundle, or defaultValue if none is found |
getText | String getText(String key, String defaultValue, String obj)(Code) | | Gets a message based on a key using the supplied obj, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned.
Parameters: key - the resource bundle key that is to be searched for Parameters: defaultValue - the default value which will be returned if no message is found Parameters: obj - obj to be used in a java.text.MessageFormat message the message as found in the resource bundle, or defaultValue if none is found |
getText | String getText(String key, List args)(Code) | | Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or null if no message is found.
Parameters: key - the resource bundle key that is to be searched for Parameters: args - a list args to be used in a java.text.MessageFormat message the message as found in the resource bundle, or null if none is found. |
getText | String getText(String key, String[] args)(Code) | | Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or null if no message is found.
Parameters: key - the resource bundle key that is to be searched for Parameters: args - an array args to be used in a java.text.MessageFormat message the message as found in the resource bundle, or null if none is found. |
getText | String getText(String key, String defaultValue, List args)(Code) | | Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned.
Parameters: key - the resource bundle key that is to be searched for Parameters: defaultValue - the default value which will be returned if no message is found Parameters: args - a list args to be used in a java.text.MessageFormat message the message as found in the resource bundle, or defaultValue if none is found |
getText | String getText(String key, String defaultValue, String[] args)(Code) | | Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned.
Parameters: key - the resource bundle key that is to be searched for Parameters: defaultValue - the default value which will be returned if no message is found Parameters: args - an array args to be used in a java.text.MessageFormat message the message as found in the resource bundle, or defaultValue if none is found |
getText | String getText(String key, String defaultValue, List args, OgnlValueStack stack)(Code) | | Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned. Instead of using the value stack in the ActionContext
this version of the getText() method uses the provided value stack.
Parameters: key - the resource bundle key that is to be searched for Parameters: defaultValue - the default value which will be returned if no message is found Parameters: args - a list args to be used in a java.text.MessageFormat message Parameters: stack - the value stack to use for finding the text the message as found in the resource bundle, or defaultValue if none is found |
getText | String getText(String key, String defaultValue, String[] args, OgnlValueStack stack)(Code) | | Gets a message based on a key using the supplied args, as defined in
java.text.MessageFormat , or, if the message is not found, a supplied
default value is returned. Instead of using the value stack in the ActionContext
this version of the getText() method uses the provided value stack.
Parameters: key - the resource bundle key that is to be searched for Parameters: defaultValue - the default value which will be returned if no message is found Parameters: args - an array args to be used in a java.text.MessageFormat message Parameters: stack - the value stack to use for finding the text the message as found in the resource bundle, or defaultValue if none is found |
getTexts | ResourceBundle getTexts(String bundleName)(Code) | | Get the named bundle, such as "com/acme/Foo".
Parameters: bundleName - the name of the resource bundle, such as "com/acme/Foo" |
getTexts | ResourceBundle getTexts()(Code) | | Get the resource bundle associated with the implementing class (usually an action).
|
hasKey | boolean hasKey(String key)(Code) | | Checks if a message key exists.
Parameters: key - boolean true if key exists, false otherwise. |
|
|