public class ResourceLocator extends Object
Constructor and Description |
---|
ResourceLocator() |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final boolean removeLookupClassLoader(ClassLoader cl)
cl
- ClassLoader
to be removed, if present.true
if this list contained the specified ClassLoader.public static final void addLookupClassLoader(ClassLoader cl)
public static final List<ClassLoader> getLookupClassLoaders()
public static final Locale getPreferredLocale()
public static final void setPreferredLocale(Locale preferredLocale)
preferredLocale
- public static Iterator<URL> getResourceURLIterator(String resourceName)
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.resourceName
- getPreferredLocale()
,
setPreferredLocale(Locale)
public static Iterator<URL> getResourceURLIterator(String resourceName, Locale preferredLocale)
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.resourceName
- preferredLocale
- getPreferredLocale()
,
setPreferredLocale(Locale)
Copyright © 2024 levigo holding gmbh. All rights reserved.