public class ClassDiscovery extends Object implements RevisionHandler
ClassDiscovery.StringCompare| Modifier and Type | Class and Description |
|---|---|
static class |
ClassDiscovery.StringCompare
compares two strings.
|
| Modifier and Type | Field and Description |
|---|---|
static boolean |
VERBOSE
whether to output some debug information.
|
| Constructor and Description |
|---|
ClassDiscovery() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearCache()
clears the cache for class/classnames queries.
|
static void |
clearClassCache()
Calls clearCache() and resets the cache of classes on the classpath (i.e.
|
static Vector<String> |
find(Class<?> cls,
String pkgname)
Checks the given package for classes that inherited from the given class,
in case it's a class, or implement this class, in case it's an interface.
|
static Vector<String> |
find(Class<?> cls,
String[] pkgnames)
Checks the given packages for classes that inherited from the given class,
in case it's a class, or implement this class, in case it's an interface.
|
static ArrayList<String> |
find(String matchText)
Find all classes that have the supplied matchText String in their suffix.
|
static Vector<String> |
find(String classname,
String pkgname)
Checks the given package for classes that inherited from the given class,
in case it's a class, or implement this class, in case it's an interface.
|
static Vector<String> |
find(String classname,
String[] pkgnames)
Checks the given packages for classes that inherited from the given class,
in case it's a class, or implement this class, in case it's an interface.
|
static Vector<String> |
findPackages()
Lists all packages it can find in the classpath.
|
String |
getRevision()
Returns the revision string.
|
static boolean |
hasInterface(Class<?> intf,
Class<?> cls)
Checks whether the given class implements the given interface.
|
static boolean |
hasInterface(String intf,
String cls)
Checks whether the given class implements the given interface.
|
static boolean |
isSubclass(Class<?> superclass,
Class<?> otherclass)
Checks whether the "otherclass" is a subclass of the given "superclass".
|
static boolean |
isSubclass(String superclass,
String otherclass)
Checks whether the "otherclass" is a subclass of the given "superclass".
|
static void |
main(String[] args)
Possible calls:
weka.core.ClassDiscovery <packages>
Prints all the packages in the current classpath weka.core.ClassDiscovery <classname> <packagename(s)> Prints the classes it found. |
public static final boolean VERBOSE
public static boolean isSubclass(String superclass, String otherclass)
superclass - the superclass to check againstotherclass - this class is checked whether it is a subclass of the the
superclasspublic static boolean isSubclass(Class<?> superclass, Class<?> otherclass)
superclass - the superclass to check againstotherclass - this class is checked whether it is a subclass of the the
superclasspublic static boolean hasInterface(String intf, String cls)
intf - the interface to look for in the given classcls - the class to check for the interfacepublic static boolean hasInterface(Class<?> intf, Class<?> cls)
intf - the interface to look for in the given classcls - the class to check for the interfacepublic static Vector<String> find(String classname, String[] pkgnames)
classname - the class/interface to look forpkgnames - the packages to search inpublic static Vector<String> find(String classname, String pkgname)
classname - the class/interface to look forpkgname - the package to search inpublic static Vector<String> find(Class<?> cls, String[] pkgnames)
cls - the class/interface to look forpkgnames - the packages to search inpublic static ArrayList<String> find(String matchText)
matchText - the text to matchpublic static Vector<String> find(Class<?> cls, String pkgname)
cls - the class/interface to look forpkgname - the package to search inpublic static Vector<String> findPackages()
public static void clearCache()
public static void clearClassCache()
public String getRevision()
getRevision in interface RevisionHandlerpublic static void main(String[] args)
args - the commandline argumentsCopyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.