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 returning 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 returning 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 returning 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 returning 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 returning 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)
It will consult each individual
TextProvider s and return true if either one of the TextProvider " has such a key else false. |
public CompositeTextProvider(List<TextProvider> textProviders)
CompositeTextProvider
with some predefined textProviders
.textProviders
- list of text providerspublic CompositeTextProvider(TextProvider[] textProviders)
CompositeTextProvider
with some predefined textProviders
.textProviders
- array of text providerspublic boolean hasKey(String key)
TextProvider
s and return true if either one of the TextProvider
" has such a key
else false.hasKey
in interface TextProvider
key
- The key to lookup in resource bundles.TextProvider.hasKey(String)
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 resource bundles.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
- the message keydefaultValue
- the default valueTextProvider.getText(String, String)
public String getText(String key, String defaultValue, String obj)
TextProvider
s and return the first valid message for this
key
, before returning defaultValue
if every else fails.getText
in interface TextProvider
key
- the message keydefaultValue
- the default valueobj
- objectTextProvider.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
- the message keyargs
- additional argumentsTextProvider.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
- the message keyargs
- additional argumentsTextProvider.getText(String, String[])
public String getText(String key, String defaultValue, List<?> args)
TextProvider
s and return the first valid message for this
key
, before returning defaultValue
getText
in interface TextProvider
key
- the message keydefaultValue
- the default valueargs
- additional argumentsTextProvider.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 returning defaultValue
.getText
in interface TextProvider
key
- the message keydefaultValue
- the default valueargs
- additional argumentsTextProvider.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 returning defaultValue
getText
in interface TextProvider
key
- the message keydefaultValue
- the default valueargs
- additional argumentsstack
- the value stackTextProvider.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 returning defaultValue
getText
in interface TextProvider
key
- the message keydefaultValue
- the default valueargs
- additional argumentsstack
- the value stackTextProvider.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
- the bundle nameTextProvider.getTexts(String)
public ResourceBundle getTexts()
TextProvider
s and return the first non-null ResourceBundle
.getTexts
in interface TextProvider
TextProvider.getTexts()
Copyright © 2000–2020 Apache Software Foundation. All rights reserved.