2.17.2: 2011-06-17

net.sf.basedb.core
Class Presets.Preset

java.lang.Object
  extended by net.sf.basedb.core.Presets.Preset
All Implemented Interfaces:
Iterable<Map.Entry<String,String>>
Enclosing class:
Presets

public static class Presets.Preset
extends Object
implements Iterable<Map.Entry<String,String>>

Represents a single preset. A preset contains any number of key-value pairs (string). A named preset has a non-null name.


Field Summary
private  String name
          The name of this preset.
private  Map<String,String> settings
          The key-value pairs in this preset.
 
Constructor Summary
private Presets.Preset()
           
private Presets.Preset(Element preset)
          Load preset name and key-value pairs from XML Document.
private Presets.Preset(String name)
           
 
Method Summary
private  void buildDom(Element element)
          Add XML elements to the parent element for this preset's key-value pairs.
 String getName()
          Get the name of this preset.
 String getSetting(String name)
          Get the value for the setting with the specified name.
 Iterator<Map.Entry<String,String>> iterator()
          Iterate over all settings.
 void setSetting(String name, String value)
          Set a value for the specified setting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

private Map<String,String> settings
The key-value pairs in this preset.


name

private String name
The name of this preset. Null for the default.

Constructor Detail

Presets.Preset

private Presets.Preset()

Presets.Preset

private Presets.Preset(String name)

Presets.Preset

private Presets.Preset(Element preset)
Load preset name and key-value pairs from XML Document.

Parameters:
preset -
Method Detail

iterator

public Iterator<Map.Entry<String,String>> iterator()
Iterate over all settings.

Specified by:
iterator in interface Iterable<Map.Entry<String,String>>

buildDom

private void buildDom(Element element)
Add XML elements to the parent element for this preset's key-value pairs. The parent element is either a <preset> or a <default> element.

Parameters:
element - The parent element to add this preset to

getName

public String getName()
Get the name of this preset.

Returns:
The name, or null if this is the default preset

getSetting

public String getSetting(String name)
Get the value for the setting with the specified name.

Parameters:
name - The name of the setting
Returns:
The value or null if no value exists

setSetting

public void setSetting(String name,
                       String value)
Set a value for the specified setting.

Parameters:
name - The name of the setting
value - The value, use null to remove the setting

2.17.2: 2011-06-17