Class PackageStringResourceLoader

  • All Implemented Interfaces:
    IStringResourceLoader

    public class PackageStringResourceLoader
    extends ComponentStringResourceLoader
    This is one of Wicket's default string resource loaders.

    The package based string resource loader attempts to find the resource from a bundle that corresponds to the supplied component objects package or one of its parent packages.

    The search order for resources is component object package towards root package.

    This implementation is fully aware of both locale and style values when trying to obtain the appropriate resources.

    Looks for file called package.properties

    Author:
    Juergen Donnerstag, igor.vaynberg
    • Method Detail

      • loadStringResource

        public String loadStringResource​(Class<?> clazz,
                                         String key,
                                         Locale locale,
                                         String style,
                                         String variation)
        Description copied from interface: IStringResourceLoader
        Get the string resource for the given combination of component class, resource key, locale and style. The component class provided is used to allow implementation of component specific resource loading (e.g. per page or per reusable component). The key should be a String containing a lookup key into a resource bundle. The locale should contain the locale of the current operation so that the appropriate set of resources can be selected. The style allows the set of resources to select to be varied by skin/brand.
        Specified by:
        loadStringResource in interface IStringResourceLoader
        Overrides:
        loadStringResource in class ComponentStringResourceLoader
        Parameters:
        clazz - The class to get the string resource for
        key - The key should be a String containing a lookup key into a resource bundle
        locale - The locale should contain the locale of the current operation so that the appropriate set of resources can be selected
        style - The style identifying the resource set to select the strings from (see Session)
        variation - The components variation (of the style)
        Returns:
        The string resource value or null if the resource could not be loaded by this loader
      • getFilename

        public String getFilename()
        Gets the properties file filename (without extension)
        Returns:
        filename
      • setFilename

        public void setFilename​(String filename)
        Sets the properties filename (without extension)
        Parameters:
        filename - filename