Package org.apache.struts2.text
Class CompositeTextProvider
java.lang.Object
org.apache.struts2.text.CompositeTextProvider
- All Implemented Interfaces:
TextProvider
This is a composite
TextProvider that takes in an array or List of TextProviders, 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.- Author:
- tmjee
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeTextProvider(List<TextProvider> textProviders) Instantiates aCompositeTextProviderwith some predefinedtextProviders.CompositeTextProvider(TextProvider[] textProviders) Instantiates aCompositeTextProviderwith some predefinedtextProviders. -
Method Summary
Modifier and TypeMethodDescriptionIt will consult eachTextProviders and return the first valid message for thiskeyIt will consult eachTextProviders and return the first valid message for thiskeybefore returningdefaultValueif every else fails.It will consult eachTextProviders and return the first valid message for thiskey.It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValueif every else fails.It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValue.getText(String key, String defaultValue, String[] args, ValueStack stack) It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValueIt will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValuegetText(String key, String defaultValue, List<?> args, ValueStack stack) It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValueIt will consult eachTextProviders and return the first valid message for thiskey.getTexts()It will consult eachTextProviders and return the first non-nullResourceBundle.It will consult eachTextProviders and return the first non-nullResourceBundle.booleanIt will consult each individualTextProviders and return true if either one of theTextProvider" has such akeyelse false.
-
Constructor Details
-
CompositeTextProvider
Instantiates aCompositeTextProviderwith some predefinedtextProviders.- Parameters:
textProviders- list of text providers
-
CompositeTextProvider
Instantiates aCompositeTextProviderwith some predefinedtextProviders.- Parameters:
textProviders- array of text providers
-
-
Method Details
-
hasKey
It will consult each individualTextProviders and return true if either one of theTextProvider" has such akeyelse false.- Specified by:
hasKeyin interfaceTextProvider- Parameters:
key- The key to lookup in resource bundles.- Returns:
- true, if the requested key is found in one of the resource bundles.
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey- Specified by:
getTextin interfaceTextProvider- Parameters:
key- The key to lookup in resource bundles.- Returns:
- The i18n text for the requested key.
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskeybefore returningdefaultValueif every else fails.- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keydefaultValue- the default value- Returns:
- the first valid message for the key or default value
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValueif every else fails.- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keydefaultValue- the default valueobj- object- Returns:
- the first valid message for the key or default value
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey.- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keyargs- additional arguments- Returns:
- the first valid message for the key
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey.- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keyargs- additional arguments- Returns:
- the first valid message for the key or default value
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValue- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keydefaultValue- the default valueargs- additional arguments- Returns:
- the first valid message for the key or default value
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValue.- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keydefaultValue- the default valueargs- additional arguments- Returns:
- the first valid message for the key or default value
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValue- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keydefaultValue- the default valueargs- additional argumentsstack- the value stack- Returns:
- the first valid message for the key or default value
- See Also:
-
getText
It will consult eachTextProviders and return the first valid message for thiskey, before returningdefaultValue- Specified by:
getTextin interfaceTextProvider- Parameters:
key- the message keydefaultValue- the default valueargs- additional argumentsstack- the value stack- Returns:
- the first valid message for the key or default value
- See Also:
-
getTexts
It will consult eachTextProviders and return the first non-nullResourceBundle.- Specified by:
getTextsin interfaceTextProvider- Parameters:
bundleName- the bundle name- Returns:
- the resource bundle found for bundle name
- See Also:
-
getTexts
It will consult eachTextProviders and return the first non-nullResourceBundle.- Specified by:
getTextsin interfaceTextProvider- Returns:
- the resource bundle
- See Also:
-