public class ClassHelper extends Object
This class provides API for instantiating new classes.
Constructor and Description |
---|
ClassHelper() |
Modifier and Type | Method and Description |
---|---|
static ClassLoader |
getDefaultClassLoader()
Return default class loader to instantiate a new class.
|
static InputStream |
loadFromClassLoader(Object caller,
String path) |
static InputStream |
loadFromDefaultClassLoader(String path) |
static Object |
newInstance(String type)
Create a new instance of the given type.
|
static String |
toFullClassName(Object c) |
static String |
toSimpleClassName(Object c) |
public static ClassLoader getDefaultClassLoader() throws Exception
Return default class loader to instantiate a new class.
The source for this method was taken from struts 1 code RequestUtils : http://svn.apache.org/repos/asf/struts/struts1/trunk/org.fugerit.java.core/src/main/java/org/apache/struts/util/RequestUtils.java
Exception
- in case of troubles during the operationpublic static Object newInstance(String type) throws Exception
Create a new instance of the given type.
type
- fully qualified name fo the class for which the new instance will be createdException
- in case of troubles during the operationpublic static InputStream loadFromClassLoader(Object caller, String path) throws Exception
Exception
public static InputStream loadFromDefaultClassLoader(String path) throws Exception
Exception
Copyright © 2022 Fugerit. All rights reserved.