Modifier and Type | Field and Description |
---|---|
static String |
MAPPINGS
The location of the classmappings.xml document.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
assignable(String srcClassName,
String parentClassName)
checks if
srcClassName is a subclass of parentClassname . |
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 Class<?> |
getMappedClass(String requestedClass)
Finds a mapped class from the c_classMappings list.
|
static <T> T |
getMappedObject(String requestedClass)
This method is used to locate and instantiate a mapped class.
|
static <T> T |
getMappedObject(String requestedClass,
Object... initargs)
This method is used to locate and instantiate a mapped class.
|
public static final String MAPPINGS
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 <T> T getMappedObject(String requestedClass) throws ReflectiveOperationException, IllegalArgumentException
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.IllegalArgumentException
- If the class cannot be found or instantiated.ReflectiveOperationException
- If the class cannot be found or instantiated.public static <T> T getMappedObject(String requestedClass, Object... initargs) throws ReflectiveOperationException, IllegalArgumentException
"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
.IllegalArgumentException
- If the class cannot be found or instantiated.ReflectiveOperationException
- If the class cannot be found or instantiated.public static Class<?> getMappedClass(String requestedClass) throws ClassNotFoundException
requestedClass
- ClassNotFoundException
public static boolean assignable(String srcClassName, String parentClassName)
srcClassName
is a subclass of parentClassname
.srcClassName
- expected subclass.parentClassName
- expected parent class.true
if srcClassName
is a subclass of parentClassname
, false
otherwise.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.