net.sf.jeters.util
Class AssistedConfigurable
java.lang.Object
net.sf.jeters.util.AssistedConfigurable
- All Implemented Interfaces:
- Configurable
- Direct Known Subclasses:
- DefaultCLI
public abstract class AssistedConfigurable
- extends java.lang.Object
- implements Configurable
this class offers its subclasses a convenient way to handle configurations
that makes dealing with Configurations and ConfigEntries unnecessary.
In order to use this way of configuration, components simply have to extend
this class and choose names starting with "conf_" for all of their attributes
intended to be configurable. This class will deal with everything else to
allow configuration via xml files, command line or whatever other means the
JETERS installation might offer.
Note, however, that "conf_" attributes may only have one of the following
types or be an one-dimensional array thereof:
Integer/int, Boolean/boolean, Float/float, String
The functionality from this class is also included in
AssistedComponent
.
- Author:
- Tobias Knerr
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AssistedConfigurable
public AssistedConfigurable()
getConfiguration
public Configuration getConfiguration()
- Description copied from interface:
Configurable
- this method is called to retrieve the current configuration for this
component. It will e.g. be used for storing changes made during
component usage to the configuration file. If it is called before
setConfiguration
, a default configuration for this
component is expected to be returned (which is used, among other things,
for creating the initial config file).
- Specified by:
getConfiguration
in interface Configurable
- Returns:
- configuration currently used by the component; not null
setConfiguration
public void setConfiguration(Configuration configuration)
- Description copied from interface:
Configurable
- sets the configuration for this object. The referenced configuration
will not change after being passed to configurationSet. However, it is
possible that setConfiguration is called again. This will not happen
during execution of other component methods.
Any config passed to setConfiguration is guaranteed to include at least
those configuration entries that were included in a previous
getConfiguration result, thus you needn't check for missing entries.
The object must not rely on this method being called. Instead, it then
has to work with a default configuration.
- Specified by:
setConfiguration
in interface Configurable
- Parameters:
configuration
- configuration to be used by the component; not null