Specialization of abstract interface class ConfigurationPlugin, which holds configuration variables in memory. Instances of this class are used to create two plug-ins within standard configurations:
This class in addition acts as the parent of class IniFile and potentially other (custom) classes. For this reason, it divides the set of variables into sections (according to the category), allows comment strings for variables and sections, and virtualizes the some key methods to allow descendants to take specific actions.
This class offers important internal fields and types for public access (bauhaus code style). However, in standard cases, only the interface methods of this class should be used.
Inner Classes | |
class | Entry |
class | Section |
Public Fields | |
ArrayList< Section > | sections = new ArrayList<Section>() |
Public Fields inherited from ConfigurationPlugin | |
XTernalizer | stringConverter |
Public Methods | |
InMemoryPlugin () | |
boolean | load (Variable variable, boolean searchOnly) |
void | reset () |
Section | searchOrCreateSection (CharSequence name, AString comments) |
Section | searchSection (CharSequence name) |
boolean | store (Variable variable) |
Public Methods inherited from ConfigurationPlugin | |
boolean | load (Variable variable) |
boolean | store (Variable variable, Object externalizedValue) |
Protected Methods | |
Section | createSection (CharSequence name) |
Protected Methods inherited from ConfigurationPlugin | |
ConfigurationPlugin () | |
Additional Inherited Members | |
Protected Fields inherited from ConfigurationPlugin | |
XTernalizer | defaultStringConverter = new XTernalizer() |
InMemoryPlugin | ( | ) |
Constructor.
|
protected |
Virtual method to create a section. (Provided to allow descendant classes to created extended versions of an entry.)
name | The name of the section |
Reimplemented in IniFile.
boolean load | ( | Variable | variable, |
boolean | searchOnly | ||
) |
Searches the variable in our storage.
variable | The variable to retrieve. |
searchOnly | If true , the variable is not read. Defaults to false . |
true
if variable was found, false
if not. Reimplemented from ConfigurationPlugin.
void reset | ( | ) |
Searches the Section with the given name. If the section was not found, it is created. If the section is found and has no comments, then the provided comments are appended.
name | The name of the section to be retrieved. |
comments | The comment lines for the section, in the case the section is not found. If this is null, no section comments are created. |
Section searchSection | ( | CharSequence | name | ) |
Searches the Section with the given name.
name | The name of the section to be retrieved. |
null
otherwise. boolean store | ( | Variable | variable | ) |
Creates or replaces existing variable in our storage.
variable | The variable to retrieve. |
true
if the variable was written, false
if not. The latter might only happen if the variable given was illegal, e.g. empty name. Reimplemented from ConfigurationPlugin.
Reimplemented in IniFile.