|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.util.classutil.ClassUtil
public class ClassUtil
Miscellaneous class-related utility methods.
| Method Summary | |
|---|---|
static boolean |
fileCanContainClasses(java.io.File file)
Determine whether a file is a jar file, zip file or directory (i.e., represents places that can be searched for classes). |
static java.lang.String |
getShortClassName(java.lang.Class cls)
Strip the package name from a fully-qualified class name and return just the short class name. |
static java.lang.String |
getShortClassName(java.lang.String fullClassName)
Strip the package name from a fully-qualified class name and return just the short class name. |
static java.lang.Object |
instantiateClass(java.lang.String className)
Convenience method that loads a class and attempts to instantiate it via its default constructor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean fileCanContainClasses(java.io.File file)
file - the file to check
public static java.lang.String getShortClassName(java.lang.String fullClassName)
fullClassName - the full class name
public static java.lang.String getShortClassName(java.lang.Class cls)
cls - the Class object whose name is to be trimmed
public static java.lang.Object instantiateClass(java.lang.String className)
throws ClassUtilException
ClassUtilException, reducing the number of lines of code
necessary to instantiate a class given its name. Note that this method
only catches and wraps checked exceptions. Unchecked exceptions,
such as ExceptionInInitializerError, are propagated directly
to the caller.
className - the fully-qualified class name
ClassUtilException - on error
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||