Home » xwork-2.1.5 » com.opensymphony » xwork2 » [javadoc | source]
com.opensymphony.xwork2
public interface: TextProvider [javadoc | source]

All Known Implementing Classes:
    ActionSupport, AppendingValidatorContext, DelegatingValidatorContext, ValidatorContext, CompositeTextProvider, DefaultTextProvider, ResourceBundleTextProvider, TextProviderSupport

Provides access to ResourceBundle s and their underlying text messages. Implementing classes can delegate TextProviderSupport . Messages will be searched in multiple resource bundles, startinag 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.

Method from com.opensymphony.xwork2.TextProvider Summary:
getText,   getText,   getText,   getText,   getText,   getText,   getText,   getText,   getText,   getTexts,   getTexts,   hasKey
Method from com.opensymphony.xwork2.TextProvider Detail:
 public String getText(String key)
    Gets a message based on a message key, or null if no message is found.
 public 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.
 public String getText(String key,
    List<Object> 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.
 public 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.
 public 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.
 public String getText(String key,
    String defaultValue,
    List<Object> 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.
 public 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.
 public String getText(String key,
    String defaultValue,
    List<Object> args,
    ValueStack 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. Instead of using the value stack in the ActionContext this version of the getText() method uses the provided value stack.
 public String getText(String key,
    String defaultValue,
    String[] args,
    ValueStack 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. Instead of using the value stack in the ActionContext this version of the getText() method uses the provided value stack.
 public ResourceBundle getTexts()
    Get the resource bundle associated with the implementing class (usually an action).
 public ResourceBundle getTexts(String bundleName)
    Get the named bundle, such as "com/acme/Foo".
 public boolean hasKey(String key)
    Checks if a message key exists.