Spring Framework

org.springframework.core.io.support
Class LocalizedResourceHelper

java.lang.Object
  extended by org.springframework.core.io.support.LocalizedResourceHelper

public class LocalizedResourceHelper
extends java.lang.Object

Helper class for loading a localized resource, specified through name, extension and current locale.

Since:
1.2.5
Author:
Juergen Hoeller

Field Summary
static java.lang.String DEFAULT_SEPARATOR
          The default separator to use inbetween file name parts: an underscore
 
Constructor Summary
LocalizedResourceHelper()
          Create a new LocalizedResourceHelper with a DefaultResourceLoader.
LocalizedResourceHelper(ResourceLoader resourceLoader)
          Create a new LocalizedResourceHelper with the given ResourceLoader.
 
Method Summary
 Resource findLocalizedResource(java.lang.String name, java.lang.String extension, java.util.Locale locale)
          Find the most specific localized resource for the given name, extension and locale:
 void setSeparator(java.lang.String separator)
          Set the separator to use inbetween file name parts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final java.lang.String DEFAULT_SEPARATOR
The default separator to use inbetween file name parts: an underscore

See Also:
Constant Field Values
Constructor Detail

LocalizedResourceHelper

public LocalizedResourceHelper()
Create a new LocalizedResourceHelper with a DefaultResourceLoader.

See Also:
DefaultResourceLoader

LocalizedResourceHelper

public LocalizedResourceHelper(ResourceLoader resourceLoader)
Create a new LocalizedResourceHelper with the given ResourceLoader.

Parameters:
resourceLoader - the ResourceLoader to use
Method Detail

setSeparator

public void setSeparator(java.lang.String separator)
Set the separator to use inbetween file name parts. Default is an underscore ("_").


findLocalizedResource

public Resource findLocalizedResource(java.lang.String name,
                                      java.lang.String extension,
                                      java.util.Locale locale)
Find the most specific localized resource for the given name, extension and locale:

The file will be searched with locations in the following order, similar to java.util.ResourceBundle's search order:

If none of the specific files can be found, a resource descriptor for the default location will be returned.

Parameters:
name - the name of the file, without localization part nor extension
extension - the file extension (e.g. ".xls")
locale - the current locale (may be null)
Returns:
the most specific localized resource found
See Also:
ResourceBundle

Spring Framework