Package org.eclipse.jetty.util
Class Loader
java.lang.Object
org.eclipse.jetty.util.Loader
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic URL
getResource
(String name) static ResourceBundle
getResourceBundle
(String name, boolean checkParents, Locale locale) static Class
Load a class.static Class
Load a class.
-
Constructor Details
-
Loader
public Loader()
-
-
Method Details
-
getResource
-
loadClass
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:
ClassNotFoundException
- if not able to find the class
-
loadClass
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:
ClassNotFoundException
- if not able to find the class
-
getResourceBundle
public static ResourceBundle getResourceBundle(String name, boolean checkParents, Locale locale) throws MissingResourceException - Throws:
MissingResourceException
-