Class BundleStringResourceLoader
- java.lang.Object
-
- org.apache.wicket.resource.loader.BundleStringResourceLoader
-
- All Implemented Interfaces:
IStringResourceLoader
public class BundleStringResourceLoader extends Object implements IStringResourceLoader
Implementation of a string resource loader that sits on top of the ordinary Java resource bundle mechanism. When created this loader must be given the name of the resource bundle that it is to sit on top of. Note that this implementation does not make use of any style or component specific knowledge - it utilizes just the bundle name, the resource key and the locale.- Author:
- Chris Turner
-
-
Constructor Summary
Constructors Constructor Description BundleStringResourceLoader(String bundleName)
Create the loader with the name of the given Java resource bundle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation)
Get the value via a Java ResourceBundleString
loadStringResource(Component component, String key, Locale locale, String style, String variation)
Get the requested string resource from the underlying resource bundle.
-
-
-
Constructor Detail
-
BundleStringResourceLoader
public BundleStringResourceLoader(String bundleName)
Create the loader with the name of the given Java resource bundle.- Parameters:
bundleName
- The name of the resource bundle
-
-
Method Detail
-
loadStringResource
public final String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation)
Get the value via a Java ResourceBundle- Specified by:
loadStringResource
in interfaceIStringResourceLoader
- Parameters:
clazz
- 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 (seeSession
)variation
- The components variation (of the style)- Returns:
- The string resource value or null if the resource could not be loaded by this loader
-
loadStringResource
public final String loadStringResource(Component component, String key, Locale locale, String style, String variation)
Get the requested string resource from the underlying resource bundle. The bundle is selected by locale and the string obtained from the best matching bundle.- Specified by:
loadStringResource
in interfaceIStringResourceLoader
- Parameters:
component
- Used to get the localekey
- The key to obtain the string forlocale
- If != null, it supersedes the component's localestyle
- ignoredvariation
- ignored- Returns:
- The string resource value or null if resource not found
-
-