|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
org.apache.myfaces.trinidad.util.ClassLoaderUtils
public final class ClassLoaderUtils
Utility methods for accessing classes and resources using an appropriate class loader.
| Method Summary | ||
|---|---|---|
static java.lang.ClassLoader |
getContextClassLoader()Dynamically accesses the current context class loader. |
|
static java.net.URL |
getResource(java.lang.String name)Locates the resource with the specified name. |
|
static java.net.URL |
getResource(java.lang.String name, java.lang.ClassLoader callerClassLoader)Locates the resource with the specified name. |
|
static java.io.InputStream |
getResourceAsStream(java.lang.String name)Locates the stream resource with the specified name. |
|
static java.io.InputStream |
getResourceAsStream(java.lang.String name, java.lang.ClassLoader callerClassLoader)Locates the resource stream with the specified name. |
|
static
|
getService(java.lang.Class<T> service)Instantiate the first registered services from a file in /META-INF/services. |
|
static
|
getService(java.lang.String service)Instantiate the first registered services from a file in /META-INF/services. |
|
static
|
getServices(java.lang.Class<T> service)Instantiate all available services from a file in /META-INF/services. |
|
static
|
getServices(java.lang.String service)Instantiate all available services from a file in /META-INF/services. |
|
static java.lang.Class<?> |
loadClass(java.lang.String name)Loads the class with the specified name. |
|
static java.lang.Class<?> |
loadClass(java.lang.String name, java.lang.ClassLoader callerClassLoader)Loads the class with the specified name. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.Class<?> loadClass(java.lang.String name)
throws java.lang.ClassNotFoundException
name - the name of the classClass objectjava.lang.ClassNotFoundException - if the class was not foundpublic static java.net.URL getResource(java.lang.String name)
name - the name of the resourceURL objectpublic static java.io.InputStream getResourceAsStream(java.lang.String name)
name - the name of the resourceInputStream object
public static java.lang.Class<?> loadClass(java.lang.String name,
java.lang.ClassLoader callerClassLoader)
throws java.lang.ClassNotFoundException
name - the name of the classcallerClassLoader - the calling class loader contextClass objectjava.lang.ClassNotFoundException - if the class was not found
public static java.net.URL getResource(java.lang.String name,
java.lang.ClassLoader callerClassLoader)
name - the name of the resourcecallerClassLoader - the calling class loader contextURL object
public static java.io.InputStream getResourceAsStream(java.lang.String name,
java.lang.ClassLoader callerClassLoader)
name - the name of the resourcecallerClassLoader - the calling class loader contextInputStream objectpublic static java.lang.ClassLoader getContextClassLoader()
public static <T> T getService(java.lang.Class<T> service)
service - the classname of the abstract service class. eg: javax.servlet.FiltergetService(String), getServices(Class), getServices(String)public static <T> T getService(java.lang.String service)
service - the classname of the abstract service class. eg: javax.servlet.FiltergetService(Class), getServices(String), getServices(Class)public static <T> java.util.List<T> getServices(java.lang.Class<T> service)
getServices(String), getService(String), getService(Class)public static <T> java.util.List<T> getServices(java.lang.String service)
The following is an excerpt from the JAR File specification: A service provider identifies itself by placing a provider-configuration file in the resource directory META-INF/services. The file's name should consist of the fully-qualified name of the abstract service class. The file should contain a newline-separated list of unique concrete provider-class names. Space and tab characters, as well as blank lines, are ignored. The comment character is '#' (0x23); on each line all characters following the first comment character are ignored. The file must be encoded in UTF-8.
service - the classname of the abstract service class. eg: javax.servlet.FiltergetServices(Class), getService(Class), getService(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.