Download Sources

com.liguorien.flex.generator.utils
Class ClassLoaderUtil

java.lang.Object
  extended by com.liguorien.flex.generator.utils.ClassLoaderUtil

public final class ClassLoaderUtil
extends java.lang.Object

Provides some utility methods to find resources through several classloaders.

Version:
0.2
Author:
Nicolas Désy

Constructor Summary
ClassLoaderUtil()
           
 
Method Summary
static boolean containsKey(java.util.ResourceBundle b, java.lang.String key)
          Determines if a ResourceBundle contains a given key.
static java.net.URL findResource(java.lang.String name)
          Finds a resource through several classloaders.
static java.util.ResourceBundle getBundle(java.lang.String name)
          Finds a ResourceBundle through several classloaders.
static java.util.Locale getLocale()
          Get the Locale of the current context FlexGenerator instance.
static java.lang.String getString(java.lang.String bundleName, java.lang.String key)
          Searchs for a String resource into a ResourceBundle through several classloaders.
static java.lang.Class<?> loadClass(java.lang.String name)
          Finds a resource through several classloaders.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderUtil

public ClassLoaderUtil()
Method Detail

findResource

public static java.net.URL findResource(java.lang.String name)

Finds a resource through several classloaders. The search sequence is the following :

Returns:
resource's URL or null if the resource cannot be found

loadClass

public static java.lang.Class<?> loadClass(java.lang.String name)

Finds a resource through several classloaders. The search sequence is the following :

Returns:
a Class instance or null if the class cannot be found

getBundle

public static java.util.ResourceBundle getBundle(java.lang.String name)

Finds a ResourceBundle through several classloaders. The search sequence is the following :

Returns:
a ResourceBundle instance or null if the bundle cannot be found

getString

public static java.lang.String getString(java.lang.String bundleName,
                                         java.lang.String key)

Searchs for a String resource into a ResourceBundle through several classloaders. The search sequence is the following :

Returns:
a String or null if the resource cannot be found

containsKey

public static boolean containsKey(java.util.ResourceBundle b,
                                  java.lang.String key)
Determines if a ResourceBundle contains a given key.

Parameters:
b - The ResourceBundle
key - The key to check
Returns:
A boolean value which indicates if the bundle contains the key.

getLocale

public static java.util.Locale getLocale()

Get the Locale of the current context FlexGenerator instance.

To Locale of the generator can be changed with FlexGenerator.setLocale(java.util.Locale). The default value is Locale.getDefault()

Returns:
A local instance.

FlexGenerator

Copyright 2006 Nicolas Désy. All rights reserved.