|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wiki.util.ClassUtil
public final class ClassUtil
Contains useful utilities for class file manipulation. This is a static class, so there is no need to instantiate it.
Field Summary | |
---|---|
static String |
MAPPINGS
The location of the classmappings.xml document. |
Method Summary | |
---|---|
static List<String> |
classpathEntriesUnder(String rootPackage)
Lists all the files in classpath under a given package. |
static Class<?> |
findClass(List<String> packages,
List<String> externaljars,
String className)
Attempts to find a class from a collection of packages. |
static Class<?> |
findClass(String packageName,
String className)
It will first attempt to instantiate the class directly from the className, and will then try to prefix it with the packageName. |
static Object |
getMappedObject(String requestedClass)
This method is used to locate and instantiate a mapped class. |
static Object |
getMappedObject(String requestedClass,
Object... initargs)
This method is used to locate and instantiate a mapped class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MAPPINGS
Method Detail |
---|
public static Class<?> findClass(List<String> packages, List<String> externaljars, String className) throws ClassNotFoundException
packages
- A List of Strings, containing different package names.className
- The name of the class to find.
ClassNotFoundException
- if this particular class cannot be found
from the list.public static Class<?> findClass(String packageName, String className) throws ClassNotFoundException
packageName
- A package name (such as "org.apache.wiki.plugins").className
- The class name to find.
ClassNotFoundException
- if this particular class cannot be found.public static List<String> classpathEntriesUnder(String rootPackage)
rootPackage
- the base package. Can be {code null}.
public static Object getMappedObject(String requestedClass) throws WikiException
ClassUtil.MAPPINGS ("ini/classmappings.xml")
.
This is an extremely powerful system, which allows you to remap many of
the JSPWiki core classes to your own class. Please read the documentation
included in the default "ini/classmappings.xml"
file to see
how this method works.
requestedClass
- The name of the class you wish to instantiate.
WikiException
- If the class cannot be found or instantiated.public static Object getMappedObject(String requestedClass, Object... initargs) throws WikiException
"ini/classmappings.xml"
.
This is an extremely powerful system, which allows you to remap many of
the JSPWiki core classes to your own class. Please read the documentation
included in the default "ini/classmappings.xml"
file to see
how this method works.
This method takes in an object array for the constructor arguments for classes which have more than two constructors.
requestedClass
- The name of the class you wish to instantiate.initargs
- The parameters to be passed to the constructor. May be null
.
WikiException
- If the class cannot be found or instantiated. The error is logged.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |