|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jeters.configuration.Configuration
public class Configuration
This class represents configurations of JETERS components.
Configuration objects are the preferred way for JETERS components to offer
customization options to the user and to store information for future
sessions. A component that wants to use configurations must implement
the interface Configurable
.
When JETERS discovers an unknown component with this interface, the first
thing it will do is to call its getConfiguration
method to
retrieve the default configuration. That will be used to create a
config file for the component and to provide a grapical interface to the user
that allows to make changes to the configuration. Once a component is known
to JETERS (which means there is a config file for it), settings from the
config file will overwrite default values. If no value is specified for an
entry present in the default configuration, this entry remains unchanged.
Before a configurable component is actually used, its
setConfiguration
method is called. This allows the object to
modify its behavior according to the configuration values.
After component usage, the getConfiguration
method is called by
JETERS. The result will be used to modify the configuration file. This allows
components to change some options during execution, for example by providing
"do not ask me this again"-checkboxes. However, it is also possible to simply
return the unchanged configuration object that came with
setConfiguration
.
Constructor Summary | |
---|---|
Configuration()
|
Method Summary | ||
---|---|---|
void |
add(net.sf.jeters.configuration.entries.ConfigEntry entry)
adds an entry to the configuration |
|
void |
add(net.sf.jeters.configuration.entries.ConfigEntry[] entries)
adds all entries from an array to the configuration |
|
void |
addEntriesFrom(Configuration other,
boolean overwrite)
adds entries from another configuration to this. |
|
Configuration |
clone()
|
|
net.sf.jeters.configuration.entries.ConfigEntry |
get(java.lang.String name)
returns the entry with the given name |
|
|
getValue(java.lang.String name)
finds the entry with the given name and returns the result of its getValue method. |
|
java.util.Iterator<net.sf.jeters.configuration.entries.ConfigEntry> |
iterator()
returns an iterator that will iterate over all configuration over all entries in this configuration. |
|
void |
remove(java.lang.String name)
removes the entry with the given name from the configuration |
|
int |
size()
returns the number of entries in this configuration |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Configuration()
Method Detail |
---|
public net.sf.jeters.configuration.entries.ConfigEntry get(java.lang.String name)
name
- name of entry that is to be returned
public <T> T getValue(java.lang.String name)
public void add(net.sf.jeters.configuration.entries.ConfigEntry entry)
entry
- entry to addpublic void add(net.sf.jeters.configuration.entries.ConfigEntry[] entries)
entries
- array of entries, must not be null,
elements must not be nullpublic void remove(java.lang.String name)
name
- name of entry that should be removedpublic int size()
public java.util.Iterator<net.sf.jeters.configuration.entries.ConfigEntry> iterator()
iterator
in interface java.lang.Iterable<net.sf.jeters.configuration.entries.ConfigEntry>
public void addEntriesFrom(Configuration other, boolean overwrite)
other
- a configuration whose entries will be added to this
config, can be null (=> no entries added)overwrite
- determines whether existing entries will be overwrittenpublic Configuration clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |