Package org.eclipse.jetty.util
Class Loader
- java.lang.Object
-
- org.eclipse.jetty.util.Loader
-
public class Loader extends java.lang.Object
ClassLoader Helper. This helper class allows classes to be loaded either from the Thread's ContextClassLoader, the classloader of the derived class or the system ClassLoader. Usage:public class MyClass { void myMethod() { ... Class c=Loader.loadClass(this.getClass(),classname); ... }
-
-
Constructor Summary
Constructors Constructor Description Loader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.URL
getResource(java.lang.String name)
static java.util.ResourceBundle
getResourceBundle(java.lang.String name, boolean checkParents, java.util.Locale locale)
static java.lang.Class
loadClass(java.lang.Class loaderClass, java.lang.String name)
Load a class.static java.lang.Class
loadClass(java.lang.String name)
Load a class.
-
-
-
Method Detail
-
getResource
public static java.net.URL getResource(java.lang.String name)
-
loadClass
public static java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
Load a class.Load a class either from the thread context classloader or if none, the system loader
- Parameters:
name
- the name of the new class to load- Returns:
- Class
- Throws:
java.lang.ClassNotFoundException
- if not able to find the class
-
loadClass
public static java.lang.Class loadClass(java.lang.Class loaderClass, java.lang.String name) throws java.lang.ClassNotFoundException
Load a class. Load a class from the same classloader as the passedloadClass
, or if none then useloadClass(String)
- Parameters:
loaderClass
- a similar class, belong in the same classloader of the desired class to loadname
- the name of the new class to load- Returns:
- Class
- Throws:
java.lang.ClassNotFoundException
- if not able to find the class
-
getResourceBundle
public static java.util.ResourceBundle getResourceBundle(java.lang.String name, boolean checkParents, java.util.Locale locale) throws java.util.MissingResourceException
- Throws:
java.util.MissingResourceException
-
-