org.jgap.data.config
Class RootConfigurationHandler
- java.lang.Object
-
- org.jgap.data.config.RootConfigurationHandler
-
- All Implemented Interfaces:
- ConfigurationHandler
public class RootConfigurationHandler extends java.lang.Object implements ConfigurationHandler
The ConfigurationHandler for the Configuration class itself. This is the entry point for a Configuration. In other words this is for dynamically building up a Configuration.- Since:
- 2.3
-
-
Constructor Summary
Constructors Constructor and Description RootConfigurationHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static voidconfigureClass(java.lang.String className)Retrieve all instances of a certain property from the config file reader and configure each of these.java.util.ListgetConfigProperties()Return the information to generate the GUI for configuring this class.java.lang.StringgetName()Return the name of this Configuration Object to be used in the properties file.java.lang.StringgetNS()Get the namespace to be used in the config file for the Configurable this ConfigurationHandler belongs to.static java.lang.reflect.FieldgetPrivateField(java.lang.Object a_instance, java.lang.String a_fieldName)Helper method: Read a private field.voidreadConfig()Method that will populate an Configurable with the properties in the config file.voidsetConfigProperty(java.lang.Object a_configurable, java.lang.String a_propertyName, java.lang.String a_value)Sets the property of a configurable to a given value.voidsetConfigurable(Configurable a_configurable)Set the Configurable to which this ConfigurationHandler belongs.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:ConfigurationHandlerReturn the name of this Configuration Object to be used in the properties file.- Specified by:
getNamein interfaceConfigurationHandler- Returns:
- Name of this Configuration Object (name of what you are configuring) to be used in the properties file.
- Since:
- 2.3
-
getConfigProperties
public java.util.List getConfigProperties()
Return the information to generate the GUI for configuring this class.- Specified by:
getConfigPropertiesin interfaceConfigurationHandler- Returns:
- a list of ConfigProperty objects
- Since:
- 2.3
-
getNS
public java.lang.String getNS()
Get the namespace to be used in the config file for the Configurable this ConfigurationHandler belongs to.- Specified by:
getNSin interfaceConfigurationHandler- Returns:
- the namespace of the Configurable
- Since:
- 2.3
-
readConfig
public void readConfig() throws ConfigException, InvalidConfigurationExceptionMethod that will populate an Configurable with the properties in the config file.- Specified by:
readConfigin interfaceConfigurationHandler- Throws:
ConfigExceptionInvalidConfigurationException- Since:
- 2.3
-
setConfigurable
public void setConfigurable(Configurable a_configurable)
Set the Configurable to which this ConfigurationHandler belongs.- Specified by:
setConfigurablein interfaceConfigurationHandler- Parameters:
a_configurable- the Configurable to which this ConfigurationHandler belongs- Since:
- 2.3
-
setConfigProperty
public void setConfigProperty(java.lang.Object a_configurable, java.lang.String a_propertyName, java.lang.String a_value) throws java.lang.IllegalAccessExceptionSets the property of a configurable to a given value. Uses reflection to do so. Queries the method getConfigVarName for the name of the field hosting the configurable properties.- Parameters:
a_configurable- the configurable to usea_propertyName- the property to seta_value- the value to assign to the property- Throws:
java.lang.IllegalAccessException- Since:
- 2.6
-
getPrivateField
public static java.lang.reflect.Field getPrivateField(java.lang.Object a_instance, java.lang.String a_fieldName)Helper method: Read a private field.- Parameters:
a_instance- the instance the field is contained witha_fieldName- the name of the field to read- Returns:
- the Field object or null, if none found
- Since:
- 2.6
-
configureClass
public static void configureClass(java.lang.String className) throws ConfigExceptionRetrieve all instances of a certain property from the config file reader and configure each of these.- Parameters:
className- the name of the property to configure- Throws:
ConfigException- Since:
- 2.4
-
-
DMelt 3.0 © DataMelt by jWork.ORG