Package weka.gui
Class GenericPropertiesCreator
java.lang.Object
weka.gui.GenericPropertiesCreator
This class can generate the properties object that is normally loaded from
the
E.g. if we want to have all the subclasses of the
For discovering the subclasses the whole classpath is inspected, which means that you can have several parallel directories with the same package structure (e.g. a release directory and a developer directory with additional classes).
The dynamic discovery can be turned off via the
GenericObjectEditor.props file (= PROPERTY_FILE). It takes
the GenericPropertiesCreator.props file as a template to
determine all the derived classes by checking the classes in the given
packages (a file with the same name in your home directory overrides the the
one in the weka/gui directory/package). E.g. if we want to have all the subclasses of the
Classifier
class then we specify the superclass ("weka.classifiers.Classifier") and the
packages where to look for ("weka.classifiers.bayes" etc.):
weka.classifiers.Classifier=\
weka.classifiers.bayes,\
weka.classifiers.functions,\
weka.classifiers.lazy,\
weka.classifiers.meta,\
weka.classifiers.trees,\
weka.classifiers.rules
This creates the same list as stored in the
GenericObjectEditor.props file, but it will also add additional
classes, that are not listed in the static list (e.g. a newly developed
Classifier), but still in the classpath. For discovering the subclasses the whole classpath is inspected, which means that you can have several parallel directories with the same package structure (e.g. a release directory and a developer directory with additional classes).
The dynamic discovery can be turned off via the
UseDyanmic
property in the props file (values: true|false).- Version:
- $Revision: 14293 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
-
CREATOR_FILEPROPERTY_FILEUSE_DYNAMICGenericObjectEditorClassDiscovery
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringname of property whether to use the dynamic approach or the old GenericObjectEditor.props filestatic final booleanwhether to output some debug information -
Constructor Summary
ConstructorsConstructorDescriptioninitializes the creator, locates the props file with the Utils class.GenericPropertiesCreator(String filename) initializes the creator, the given file overrides the props-file search of the Utils class -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()generates the props-file for the GenericObjectEditor and stores itvoidexecute(boolean store) generates the props-file for the GenericObjectEditorvoidexecute(boolean store, boolean loadInputProps) generates the props-file for the GenericObjectEditor and stores it only if the the paramstoreis TRUE.booleanreturns TRUE, if a file is loaded and not the Utils class used for locating the props file.static PropertiesGet the global input propertiesstatic PropertiesGet the global output propertiesreturns the name of the input filereturns the input properties object (template containing the packages)returns the name of the output filereturns the output properties object (structure like the template, but filled with classes instead of packages)static voidfor generating props file: no parameter: see default constructor 1 parameter (i.e., filename): see default constructor + setOutputFilename(String) 2 parameters (i.e, filenames): see constructor with String argument + setOutputFilename(String)static voidRegenerate the global output properties.voidsetExplicitPropsFile(boolean value) if FALSE, the locating of a props-file of the Utils-class is used, otherwise it's tried to load the specified filevoidsetInputFilename(String filename) sets the file to get the information about the packages from.voidsetOutputFilename(String filename) sets the file to output the properties for the GEO tobooleangets whether the dynamic approach should be used or not
-
Field Details
-
VERBOSE
public static final boolean VERBOSEwhether to output some debug information- See Also:
-
USE_DYNAMIC
name of property whether to use the dynamic approach or the old GenericObjectEditor.props file- See Also:
-
-
Constructor Details
-
GenericPropertiesCreator
initializes the creator, locates the props file with the Utils class.- Throws:
Exception- if loading of CREATOR_FILE fails- See Also:
-
CREATOR_FILEUtils.readProperties(String)loadInputProperties()
-
GenericPropertiesCreator
initializes the creator, the given file overrides the props-file search of the Utils class- Parameters:
filename- the file containing the packages to create a props file from- Throws:
Exception- if loading of the file fails- See Also:
-
CREATOR_FILEUtils.readProperties(String)loadInputProperties()
-
-
Method Details
-
getGlobalOutputProperties
Get the global output properties- Returns:
- the global output properties
-
getGlobalInputProperties
Get the global input properties- Returns:
- the global input properties
-
regenerateGlobalOutputProperties
public static void regenerateGlobalOutputProperties()Regenerate the global output properties. Does not load the input properties, instead uses the GLOBAL_INPUT_PROPERTIES -
setExplicitPropsFile
public void setExplicitPropsFile(boolean value) if FALSE, the locating of a props-file of the Utils-class is used, otherwise it's tried to load the specified file- Parameters:
value- if true the specified file will be loaded not via the Utils-class- See Also:
-
Utils.readProperties(String)loadInputProperties()
-
getExplicitPropsFile
public boolean getExplicitPropsFile()returns TRUE, if a file is loaded and not the Utils class used for locating the props file.- Returns:
- true if the specified file is used and not the one found by the Utils class
- See Also:
-
Utils.readProperties(String)loadInputProperties()
-
getOutputFilename
returns the name of the output file- Returns:
- the name of the output file
-
setOutputFilename
sets the file to output the properties for the GEO to- Parameters:
filename- the filename for the output
-
getInputFilename
returns the name of the input file- Returns:
- the name of the input file
-
setInputFilename
sets the file to get the information about the packages from. automatically sets explicitPropsFile to TRUE.- Parameters:
filename- the filename for the input- See Also:
-
getInputProperties
returns the input properties object (template containing the packages)- Returns:
- the input properties (the template)
-
getOutputProperties
returns the output properties object (structure like the template, but filled with classes instead of packages)- Returns:
- the output properties (filled with classes)
-
useDynamic
public boolean useDynamic()gets whether the dynamic approach should be used or not- Returns:
- true if the dynamic approach is to be used
-
execute
generates the props-file for the GenericObjectEditor and stores it- Throws:
Exception- if something goes wrong- See Also:
-
execute
generates the props-file for the GenericObjectEditor- Parameters:
store- true if the generated props should be stored- Throws:
Exception
-
execute
generates the props-file for the GenericObjectEditor and stores it only if the the paramstoreis TRUE. If it is FALSE then the generated properties file can be retrieved via thegetOutputPropertiesmethod.- Parameters:
store- if TRUE then the properties file is stored to the stored filenameloadInputProps- true if the input properties should be loaded- Throws:
Exception- if something goes wrong- See Also:
-
main
for generating props file:- no parameter: see default constructor
- 1 parameter (i.e., filename): see default constructor + setOutputFilename(String)
- 2 parameters (i.e, filenames): see constructor with String argument + setOutputFilename(String)
- Parameters:
args- the commandline arguments- Throws:
Exception- if something goes wrong- See Also:
-