Package weka.core
Class ClassDiscovery
java.lang.Object
weka.core.ClassDiscovery
- All Implemented Interfaces:
RevisionHandler
This class is used for discovering classes that implement a certain
interface or a derived from a certain class.
- Version:
- $Revision: 5377 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
whether to output some debug information. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clears the cache for class/classnames relation.static Vector
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
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
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
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
Lists all packages it can find in the classpath.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
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.
-
Field Details
-
VERBOSE
public static final boolean VERBOSEwhether to output some debug information.- See Also:
-
-
Constructor Details
-
ClassDiscovery
public ClassDiscovery()
-
-
Method Details
-
isSubclass
Checks whether the "otherclass" is a subclass of the given "superclass".- Parameters:
superclass
- the superclass to check againstotherclass
- this class is checked whether it is a subclass of the the superclass- Returns:
- TRUE if "otherclass" is a true subclass
-
isSubclass
Checks whether the "otherclass" is a subclass of the given "superclass".- Parameters:
superclass
- the superclass to check againstotherclass
- this class is checked whether it is a subclass of the the superclass- Returns:
- TRUE if "otherclass" is a true subclass
-
hasInterface
Checks whether the given class implements the given interface.- Parameters:
intf
- the interface to look for in the given classcls
- the class to check for the interface- Returns:
- TRUE if the class contains the interface
-
hasInterface
Checks whether the given class implements the given interface.- Parameters:
intf
- the interface to look for in the given classcls
- the class to check for the interface- Returns:
- TRUE if the class contains the interface
-
find
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.- Parameters:
classname
- the class/interface to look forpkgnames
- the packages to search in- Returns:
- a list with all the found classnames
-
find
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.- Parameters:
classname
- the class/interface to look forpkgname
- the package to search in- Returns:
- a list with all the found classnames
-
find
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.- Parameters:
cls
- the class/interface to look forpkgnames
- the packages to search in- Returns:
- a list with all the found classnames
-
find
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.- Parameters:
cls
- the class/interface to look forpkgname
- the package to search in- Returns:
- a list with all the found classnames
-
findPackages
Lists all packages it can find in the classpath.- Returns:
- a list with all the found packages
-
clearCache
public static void clearCache()clears the cache for class/classnames relation. -
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Returns:
- the revision
-
main
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.
- Parameters:
args
- the commandline arguments
-
weka.core.ClassDiscovery <packages>
-