|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjecttoxTree.core.Introspection
public class Introspection
A singleton class with static method to provide some sort of introspection :)
Used in decision tree editor to provide a list of available decision trees,
available rules, available categories.
This is done by searching for classes implementing
IDecisionMethod
, IDecisionRule
,
and IDecisionCategory
in all .jar files in a user
defined directory.
Field Summary | |
---|---|
protected static java.lang.String[] |
defaultLocation
|
protected static ToxTreeClassLoader |
loader
|
protected static TTLogger |
logger
|
static java.lang.String |
TOXTREE_HOME
|
Constructor Summary | |
---|---|
protected |
Introspection()
|
Method Summary | |
---|---|
static void |
addDirectory(java.lang.String dirName)
|
static void |
configureURLLoader(java.lang.ClassLoader classLoader)
Adds URLS of jars in default directories to the class loader. |
static void |
configureURLLoader(java.io.File directory)
Adds URLS of jars in specified directory to the class loader. |
static void |
configureURLLoader(java.io.File[] jars)
Adds URLS of jars specified in File[] to the class loader. |
static java.lang.Object |
createObject(java.lang.String className)
Creates object given the class name |
static java.io.File[] |
enumerateJars(java.io.File directory)
|
static ToxTreePackageEntries |
getAvailableCategoryTypes(java.lang.ClassLoader classLoader)
Returns a list with available categories |
static ToxTreePackageEntries |
getAvailableRuleTypes(java.lang.ClassLoader classLoader)
Returns a list with available rule names. |
static ToxTreePackageEntries |
getAvailableTreeTypes(java.lang.ClassLoader classLoader)
Returns a list with available decision trees. |
static ToxTreePackageEntries |
getAvailableTypes(java.lang.ClassLoader classLoader,
java.lang.String interfacename)
This method is the core of ToxTreeApp extension mechanism. |
static java.lang.String[] |
getDefaultDirectories()
|
static java.lang.ClassLoader |
getLoader()
|
static java.lang.String |
getToxTreeRoot()
|
static ToxTreePackageEntries |
implementInterface(java.lang.ClassLoader classLoader,
java.io.File directory,
java.lang.String interfaceName)
Finds classes implementing an interface in all .jar files in a user defined directory. |
static java.lang.Class |
implementsInterface(java.lang.Class clazz,
java.lang.String interfaceName)
Verifies if a class implements an interface |
static java.lang.Class |
implementsInterface(java.lang.String className,
java.lang.String interfaceName)
Verifies if a class implements an interface |
static void |
listBaseTypes(java.lang.Class cls,
java.lang.String prefix)
this is just a test for the concept of introspection |
static java.lang.Object |
loadCreateObject(java.lang.String className)
|
static IDecisionMethodsList |
loadForest(java.io.InputStream stream)
|
static IDecisionMethodsList |
loadForestXML(java.io.InputStream stream)
|
static IDecisionMethod |
loadRules(java.io.InputStream stream,
java.lang.String newTitle)
Loads a decision tree from an InputStream Uses Java serialization mechanism |
static IDecisionMethod |
loadRulesXML(java.io.InputStream stream,
java.lang.String newTitle)
|
static void |
saveRulesXML(IDecisionMethod method,
java.io.OutputStream out)
|
static void |
setLoader(java.lang.ClassLoader classLoader)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TOXTREE_HOME
protected static java.lang.String[] defaultLocation
protected static TTLogger logger
protected static ToxTreeClassLoader loader
Constructor Detail |
---|
protected Introspection()
Method Detail |
---|
public static void addDirectory(java.lang.String dirName)
public static java.lang.String[] getDefaultDirectories()
public static void listBaseTypes(java.lang.Class cls, java.lang.String prefix)
public static java.lang.Class implementsInterface(java.lang.String className, java.lang.String interfaceName) throws IntrospectionException
className
- -
the name of the class to be verifiedinterfaceName
- -
the name of the interface to be searched for
IntrospectionException
public static java.lang.Class implementsInterface(java.lang.Class clazz, java.lang.String interfaceName)
clazz
- -
the class to be verifiedinterfaceName
- -
the name of the interface to be searched for
public static java.io.File[] enumerateJars(java.io.File directory) throws IntrospectionException
IntrospectionException
public static void configureURLLoader(java.lang.ClassLoader classLoader)
configureURLLoader(File directory)
for each of defaultLocation
directories.
classLoader
- public static void configureURLLoader(java.io.File directory) throws IntrospectionException
directory
-
IntrospectionException
public static void configureURLLoader(java.io.File[] jars) throws IntrospectionException
jars
-
IntrospectionException
public static ToxTreePackageEntries implementInterface(java.lang.ClassLoader classLoader, java.io.File directory, java.lang.String interfaceName) throws IntrospectionException
directory
- -
the directory with jar files to be searched forinterfaceName
- -
the name of the interface to be searched for
IntrospectionException
public static ToxTreePackageEntries getAvailableRuleTypes(java.lang.ClassLoader classLoader)
getAvailableTypes(ClassLoader, String)
ArrayList
of class names that implement
IDecisionRule
public static ToxTreePackageEntries getAvailableTreeTypes(java.lang.ClassLoader classLoader)
getAvailableTypes(ClassLoader, String)
ArrayList
of class names that implement
IDecisionMethod
public static ToxTreePackageEntries getAvailableTypes(java.lang.ClassLoader classLoader, java.lang.String interfacename)
ToxTreeApp
extension mechanism.
Looks for classes that implement interface given by interfacename parameter.
Returns a list with class names.
Jar files within the following directories are analyzed:
classLoader
- interfacename
- the
ArrayList
public static ToxTreePackageEntries getAvailableCategoryTypes(java.lang.ClassLoader classLoader)
ArrayList
of class names that implement
IDecisionCategory
public static java.lang.Object createObject(java.lang.String className)
className
-
public static java.lang.Object loadCreateObject(java.lang.String className) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
public static java.lang.ClassLoader getLoader()
public static void setLoader(java.lang.ClassLoader classLoader)
public static IDecisionMethod loadRules(java.io.InputStream stream, java.lang.String newTitle) throws IntrospectionException
stream
- newTitle
-
IDecisionMethod
IntrospectionException
public static IDecisionMethodsList loadForest(java.io.InputStream stream) throws IntrospectionException
IntrospectionException
public static void saveRulesXML(IDecisionMethod method, java.io.OutputStream out) throws IntrospectionException
IntrospectionException
public static IDecisionMethod loadRulesXML(java.io.InputStream stream, java.lang.String newTitle) throws IntrospectionException
IntrospectionException
public static IDecisionMethodsList loadForestXML(java.io.InputStream stream) throws IntrospectionException
IntrospectionException
public static java.lang.String getToxTreeRoot()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |