|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object anon.util.ClassUtil
public final class ClassUtil
This class performs some basic operations related to Class objects.
Nested Class Summary | |
---|---|
private static class |
ClassUtil.ClassGetter
This small inner class is needed to get information about static classes. |
private static class |
ClassUtil.ClassInstantiator
|
static class |
ClassUtil.Package
Represents a package name. |
Field Summary | |
---|---|
private static java.lang.String |
FILE
|
private static java.lang.String |
JAR_FILE
|
private static boolean |
ms_bEnableFindSubclasses
|
private static java.util.Hashtable |
ms_loadedClasses
Stores all loaded classes. |
private static java.util.Vector |
ms_loadedDirectories
Stores all loaded directories. |
Constructor Summary | |
---|---|
private |
ClassUtil()
This class works without being initialised and is completely static. |
Method Summary | |
---|---|
static void |
addFileToClasspath(java.io.File a_file)
|
static void |
addFileToClasspath(java.lang.String a_file)
|
static void |
addURLToClasspath(java.net.URL a_url)
|
static void |
enableFindSubclasses(boolean a_benable)
|
static java.util.Vector |
findSubclasses(java.lang.Class a_class)
Gets all classes that extend the given class or implement the given interface, including the class itself. |
static java.lang.Class |
getCallingClassStatic()
Returns the class that called the current method. |
static java.io.File |
getClassDirectory(java.lang.Class a_class)
Returns the class directory of the specified class. |
static java.io.File |
getClassDirectory(java.lang.String a_className)
|
static java.lang.String |
getClassNameStatic()
Returns the name, including the package, of the calling method's class. |
static java.lang.String |
getClassPath()
Returns the current java class path. |
protected static java.lang.String |
getClassPath(boolean a_bPreventLoop)
Returns the current java class path. |
static java.lang.Class |
getClassStatic()
Returns the current class from a static context. |
static java.lang.Class |
getFirstClassFound(java.io.File a_file)
Traverse a file, directory or zip/jar file recursive until a class file is found and instantiated or all files are traversed. |
static java.util.zip.ZipFile |
getJarFile()
returns a Java Object of the JAP.jar or null if JAP is not started as jar-file |
static java.lang.String |
getShortClassName(java.lang.Class a_class)
Gets the name of a class without package (everything before the last "." is removed). |
static java.lang.String |
getUserDir()
Returns the content of the system property user.dir |
static boolean |
isFindSubclassesEnabled()
|
static java.util.Enumeration |
loadClasses()
Loads all classes into cache that are in the same file structure as this class and as the calling class. |
static java.util.Enumeration |
loadClasses(java.lang.Class a_rootClass)
|
private static java.util.Enumeration |
loadClasses(java.lang.Class a_rootClass,
java.io.File a_directory)
Loads all classes into cache that are in the same file structure as the given class and as the calling class. |
static java.util.Enumeration |
loadClasses(java.io.File a_classDirectory)
|
private static void |
loadClassesInternal(java.lang.Class a_rootClass,
java.io.File a_directory)
Loads all classes into cache that are in the same file structure as the given class. |
private static java.lang.Class |
toClass(java.io.File a_classFile,
java.io.File a_classDirectory)
Turns class files into Class objects. |
static java.lang.String |
toRelativeResourcePath(java.lang.Class a_class)
Generates a relative resource path to the given class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String JAR_FILE
private static final java.lang.String FILE
private static java.util.Hashtable ms_loadedClasses
private static java.util.Vector ms_loadedDirectories
private static boolean ms_bEnableFindSubclasses
Constructor Detail |
---|
private ClassUtil()
Method Detail |
---|
public static void addFileToClasspath(java.lang.String a_file) throws java.io.IOException, java.lang.IllegalAccessException
java.io.IOException
java.lang.IllegalAccessException
public static void addFileToClasspath(java.io.File a_file) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public static void addURLToClasspath(java.net.URL a_url) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public static java.lang.String getShortClassName(java.lang.Class a_class)
a_class
- a Class
public static java.lang.Class getClassStatic()
this
is not available there.
public static java.lang.String getClassNameStatic()
public static java.lang.Class getCallingClassStatic()
public static java.lang.String getUserDir()
public static java.lang.String getClassPath()
public static void enableFindSubclasses(boolean a_benable)
public static boolean isFindSubclassesEnabled()
public static java.util.Vector findSubclasses(java.lang.Class a_class)
a_class
- a Class
public static java.util.Enumeration loadClasses()
public static java.util.Enumeration loadClasses(java.lang.Class a_rootClass)
public static java.util.Enumeration loadClasses(java.io.File a_classDirectory)
private static java.util.Enumeration loadClasses(java.lang.Class a_rootClass, java.io.File a_directory)
a_rootClass
- the class from that loading is started
public static java.io.File getClassDirectory(java.lang.String a_className)
public static java.util.zip.ZipFile getJarFile()
public static java.io.File getClassDirectory(java.lang.Class a_class)
ZipFile
.
a_class
- a class
public static java.lang.String toRelativeResourcePath(java.lang.Class a_class)
a_class
- Class
public static java.lang.Class getFirstClassFound(java.io.File a_file)
a_file
- a file, directory or zip/jar file
protected static java.lang.String getClassPath(boolean a_bPreventLoop)
a_bPreventLoop
- true if a loop with calls in the ResourceLoader must be prevented
private static void loadClassesInternal(java.lang.Class a_rootClass, java.io.File a_directory) throws java.io.IOException
a_rootClass
- the class from that loading is startedan
- optional directory or jar/zip file to load the classes from
java.io.IOException
- if an I/O error occursprivate static java.lang.Class toClass(java.io.File a_classFile, java.io.File a_classDirectory)
a_classFile
- a class file with full directory patha_classDirectory
- the directory where all class files and class directories reside
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |