public class NestedStringResourceLoader extends Object implements IStringResourceLoader
List loaders = getResourceSettings().getStringResourceLoaders();
// Add more loaders here
NestedStringResourceLoader element = new NestedStringResourceLoader(loaders,Pattern.compile("#\\(([^ ]*?)\\)"));
loaders.clear();
loaders.add(element);
| Constructor and Description |
|---|
NestedStringResourceLoader(List<IStringResourceLoader> loaders,
Pattern pattern)
Creates a nested string resource loader
|
| Modifier and Type | Method and Description |
|---|---|
String |
loadStringResource(Class<?> clazz,
String key,
Locale locale,
String style,
String variation)
Get the string resource for the given combination of component class, resource key, locale
and style.
|
String |
loadStringResource(Component component,
String key,
Locale locale,
String style,
String variation)
Get the string resource for the given combination of component, resource key, locale and
style.
|
public NestedStringResourceLoader(List<IStringResourceLoader> loaders, Pattern pattern)
loaders - the loaders to be added in a chainpattern - the pattern for nested keys. Example for #(key) is the pattern:
Pattern.compile("#\\(([^ ]*?)\\)");public String loadStringResource(Component component, String key, Locale locale, String style, String variation)
IStringResourceLoaderloadStringResource in interface IStringResourceLoadercomponent - The component to get the string resource forkey - The key should be a String containing a lookup key into a resource bundlelocale - Will be preset with the appropriate value. You shall ignore the component's
locale.style - Will be preset with the appropriate value. You shall ignore the component's style.variation - Will be preset with the appropriate value. You shall ignore the component's
variation.public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation)
IStringResourceLoaderloadStringResource in interface IStringResourceLoaderclazz - The class to get the string resource forkey - The key should be a String containing a lookup key into a resource bundlelocale - The locale should contain the locale of the current operation so that the
appropriate set of resources can be selectedstyle - The style identifying the resource set to select the strings from (see
Session)variation - The components variation (of the style)Copyright © 2006–2021 Apache Software Foundation. All rights reserved.