com.levigo.util.swing.action
Class ResourceLocator

java.lang.Object
  extended by com.levigo.util.swing.action.ResourceLocator

public class ResourceLocator
extends Object


Constructor Summary
ResourceLocator()
           
 
Method Summary
static void addLookupClassLoader(ClassLoader cl)
           
static List<ClassLoader> getLookupClassLoaders()
           
static Locale getPreferredLocale()
          Returns a locale which is used to find preferable locale specific resources.
static Iterator<URL> getResourceURLIterator(String resourceName)
          Returns an Iterator providing all resources of the specified name from the search path used to load classes.
static Iterator<URL> getResourceURLIterator(String resourceName, Locale preferredLocale)
          Returns an Iterator providing all resources of the specified name from the search path used to load classes.
static boolean removeLookupClassLoader(ClassLoader cl)
          Removes the first occurrence of the specified ClassLoader.
static void setPreferredLocale(Locale preferredLocale)
          Changes locale which is used to find preferable locale specific resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceLocator

public ResourceLocator()
Method Detail

removeLookupClassLoader

public static final boolean removeLookupClassLoader(ClassLoader cl)
Removes the first occurrence of the specified ClassLoader.

Parameters:
cl - ClassLoader to be removed, if present.
Returns:
true if this list contained the specified ClassLoader.

addLookupClassLoader

public static final void addLookupClassLoader(ClassLoader cl)

getLookupClassLoaders

public static final List<ClassLoader> getLookupClassLoaders()

getPreferredLocale

public static final Locale getPreferredLocale()
Returns a locale which is used to find preferable locale specific resources.

Returns:
preferred locale of found resources

setPreferredLocale

public static final void setPreferredLocale(Locale preferredLocale)
Changes locale which is used to find preferable locale specific resources.

Parameters:
preferredLocale -

getResourceURLIterator

public static Iterator<URL> getResourceURLIterator(String resourceName)
Returns an Iterator providing all resources of the specified name from the search path used to load classes. Registered look up class loader will be considered too. The resources thus found are returned as an Iterator of URL objects. If a global preferred locale is defined, resource look up prefer resources matching to this locale.

Parameters:
resourceName -
Returns:
iterator of URL objects
See Also:
getPreferredLocale(), setPreferredLocale(Locale)

getResourceURLIterator

public static Iterator<URL> getResourceURLIterator(String resourceName,
                                                   Locale preferredLocale)
Returns an Iterator providing all resources of the specified name from the search path used to load classes. Registered look up class loader will be considered too. The resources thus found are returned as an Iterator of URL objects. If the preferredLocale parameter is not null, locale specific resources are the preferred returned URLs. If a global preferred locale is defined too, resource look up prefer resources matching to the given locale followed by resources matching the global locale and finally the default resources.

Parameters:
resourceName -
preferredLocale -
Returns:
iterator of URL objects
See Also:
getPreferredLocale(), setPreferredLocale(Locale)


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.