Package org.graffiti.util
Class InstanceLoader
java.lang.Object
org.graffiti.util.InstanceLoader
public class InstanceLoader extends Object
Represents an instance loader, which can be used to instantiate a class with
the given name.
- Since:
- 1.0
- Version:
- 1.11
- Recent revisions:
- 2.6.5
-
Constructor Summary
Constructors Constructor Description InstanceLoader()
-
Method Summary
Modifier and Type Method Description static Object
createInstance(Class<?> theClass)
Returns a new instance of the specified class.static Object
createInstance(Class<?> theClass, Object param)
Returns a new instance of the specified class.static Object
createInstance(Class<?> theClass, String paramClassname, Object param)
Returns a new instance of the specified class.static Object
createInstance(String name)
Returns a new instance of the specified class.static Object
createInstance(String name, Object param)
Returns a new instance of the specified class.static ClassLoader
getCurrentLoader()
static void
overrideLoader(ClassLoader loader)
static void
setClassLoader(ClassLoader newClassloader)
-
Constructor Details
-
InstanceLoader
public InstanceLoader()
-
-
Method Details
-
overrideLoader
-
setClassLoader
-
getCurrentLoader
-
createInstance
Returns a new instance of the specified class.- Parameters:
theClass
- the class to instantiate.- Returns:
- newly instantiated instance of type theClass
- Throws:
InstanceCreationException
- when an instance couldn't be created
-
createInstance
Returns a new instance of the specified class.- Parameters:
name
- the name of the class to instantiate.- Returns:
- newly instantiated instance of type theClass
- Throws:
InstanceCreationException
- when an instance couldn't be created
-
createInstance
Returns a new instance of the specified class. Uses a constructor taking one argument.- Parameters:
name
- the name of the class to instantiate.param
- specified class' constructor argument- Returns:
- newly instantiated instance of type theClass
- Throws:
InstanceCreationException
- when an instance couldn't be created
-
createInstance
public static Object createInstance(Class<?> theClass, String paramClassname, Object param) throws InstanceCreationExceptionReturns a new instance of the specified class. Uses a constructor taking one argument.- Parameters:
theClass
- the class to instantiate.paramClassname
- the fully qualified name of the parameter class to instantiate.param
- specified class' constructor argument- Returns:
- newly instantiated instance of type theClass
- Throws:
InstanceCreationException
- when an instance couldn't be created
-
createInstance
public static Object createInstance(Class<?> theClass, Object param) throws InstanceCreationExceptionReturns a new instance of the specified class. Uses a constructor taking one argument.- Parameters:
theClass
- the name of the class to instantiate.param
- specified class' constructor argument- Returns:
- newly instantiated instance of type theClass
- Throws:
InstanceCreationException
- when an instance couldn't be created
-