public class CompositeTextProvider extends Object implements TextProvider
TextProvider
that takes in an array or List
of TextProvider
s, it will
consult each of them in order to get a composite result. To know how each method behaves, please refer to the
javadoc for each methods.Constructor and Description |
---|
CompositeTextProvider(List<TextProvider> textProviders)
Instantiates a
CompositeTextProvider with some predefined textProviders . |
CompositeTextProvider(TextProvider[] textProviders)
Instantiates a
CompositeTextProvider with some predefined textProviders . |
Modifier and Type | Method and Description |
---|---|
String |
getText(String key)
It will consult each
TextProvider s and return the first valid message for this
key |
String |
getText(String key,
List<?> args)
It will consult each
TextProvider s and return the first valid message for this
key . |
String |
getText(String key,
String defaultValue)
It will consult each
TextProvider s and return the first valid message for this
key before returning defaultValue if every else fails. |
String |
getText(String key,
String[] args)
It will consult each
TextProvider s and return the first valid message for this
key . |
String |
getText(String key,
String defaultValue,
List<?> args)
It will consult each
TextProvider s and return the first valid message for this
key , before returining defaultValue |
String |
getText(String key,
String defaultValue,
List<?> args,
ValueStack stack)
It will consult each
TextProvider s and return the first valid message for this
key , before returining defaultValue |
String |
getText(String key,
String defaultValue,
String obj)
It will consult each
TextProvider s and return the first valid message for this
key , before returining defaultValue
if every else fails. |
String |
getText(String key,
String defaultValue,
String[] args)
It will consult each
TextProvider s and return the first valid message for this
key , before returining defaultValue . |
String |
getText(String key,
String defaultValue,
String[] args,
ValueStack stack)
It will consult each
TextProvider s and return the first valid message for this
key , before returining defaultValue |
ResourceBundle |
getTexts()
It will consult each
TextProvider s and return the first non-null ResourceBundle . |
ResourceBundle |
getTexts(String bundleName)
It will consult each
TextProvider s and return the first non-null ResourceBundle . |
boolean |
hasKey(String key)
Checks if a message key exists.
|
public CompositeTextProvider(List<TextProvider> textProviders)
CompositeTextProvider
with some predefined textProviders
.textProviders
- public CompositeTextProvider(TextProvider[] textProviders)
CompositeTextProvider
with some predefined textProviders
.textProviders
- public boolean hasKey(String key)
TextProvider
hasKey
in interface TextProvider
key
- The key to lookup in ressource bundles.com.opensymphony.xwork2.TextProvider#hasKey(String)}
It will consult each individual {@link TextProvider}s and return true if either one of the
{@link TextProvider} has such a key>
else false.
public String getText(String key)
TextProvider
s and return the first valid message for this
key
getText
in interface TextProvider
key
- The key to lookup in ressource bundles.com.opensymphony.xwork2.TextProvider#getText(String)}
public String getText(String key, String defaultValue)
TextProvider
s and return the first valid message for this
key
before returning defaultValue
if every else fails.getText
in interface TextProvider
key
- defaultValue
- com.opensymphony.xwork2.TextProvider#getText(String, String)}
public String getText(String key, String defaultValue, String obj)
TextProvider
s and return the first valid message for this
key
, before returining defaultValue
if every else fails.getText
in interface TextProvider
key
- defaultValue
- obj
- com.opensymphony.xwork2.TextProvider#getText(String, String, String)}
public String getText(String key, List<?> args)
TextProvider
s and return the first valid message for this
key
.getText
in interface TextProvider
key
- args
- com.opensymphony.xwork2.TextProvider#getText(String, java.util.List)}
public String getText(String key, String[] args)
TextProvider
s and return the first valid message for this
key
.getText
in interface TextProvider
key
- args
- com.opensymphony.xwork2.TextProvider#getText(String, String[])}
public String getText(String key, String defaultValue, List<?> args)
TextProvider
s and return the first valid message for this
key
, before returining defaultValue
getText
in interface TextProvider
key
- defaultValue
- args
- com.opensymphony.xwork2.TextProvider#getText#getText(String, String, java.util.List)}
public String getText(String key, String defaultValue, String[] args)
TextProvider
s and return the first valid message for this
key
, before returining defaultValue
.getText
in interface TextProvider
key
- defaultValue
- args
- com.opensymphony.xwork2.TextProvider#getText(String, String, String[])}
public String getText(String key, String defaultValue, List<?> args, ValueStack stack)
TextProvider
s and return the first valid message for this
key
, before returining defaultValue
getText
in interface TextProvider
key
- defaultValue
- args
- stack
- com.opensymphony.xwork2.TextProvider#getText(String, String, java.util.List, com.opensymphony.xwork2.util.ValueStack)}
public String getText(String key, String defaultValue, String[] args, ValueStack stack)
TextProvider
s and return the first valid message for this
key
, before returining defaultValue
getText
in interface TextProvider
key
- defaultValue
- args
- stack
- com.opensymphony.xwork2.TextProvider#getText(String, String, String[], com.opensymphony.xwork2.util.ValueStack)}
public ResourceBundle getTexts(String bundleName)
TextProvider
s and return the first non-null ResourceBundle
.getTexts
in interface TextProvider
bundleName
- TextProvider#getTexts(String)}
public ResourceBundle getTexts()
TextProvider
s and return the first non-null ResourceBundle
.getTexts
in interface TextProvider
TextProvider#getTexts()}
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.