com.ecyrd.jspwiki.util
Class ClassUtil
java.lang.Object
com.ecyrd.jspwiki.util.ClassUtil
public class ClassUtil
- extends Object
Contains useful utilities for class file manipulation.
- Since:
- 2.1.29.
- Author:
- Janne Jalkanen
Method Summary |
static Class |
findClass(List packages,
String className)
Attempts to find a class from a collection of packages. |
static Class |
findClass(String packageName,
String className)
A shortcut for findClass when you only have a singular package to search. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassUtil
public ClassUtil()
findClass
public static Class findClass(List packages,
String className)
throws ClassNotFoundException
- Attempts to find a class from a collection of packages. This will first
attempt to find the class based on just the className parameter, but
should that fail, will iterate through the "packages" -list, prefixes
the package name to the className, and then tries to find the class
again.
- Parameters:
packages
- A List of Strings, containing different package names.className
- The name of the class to find.
- Returns:
- The class, if it was found.
- Throws:
ClassNotFoundException
- if this particular class cannot be found
from the list.
findClass
public static Class findClass(String packageName,
String className)
throws ClassNotFoundException
- A shortcut for findClass when you only have a singular package to search.
It will first attempt to instantiate the class directly from the className,
and will then try to prefix it with the packageName.
- Parameters:
packageName
- A package name (such as "com.ecyrd.jspwiki.plugins").className
- The class name to find.
- Returns:
- The class, if it was found.
- Throws:
ClassNotFoundException
- if this particular class cannot be found.