Class Presets.Preset

java.lang.Object
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 Details

    • 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 Details

    • Preset

      private Preset()
    • Preset

      private Preset​(String name)
    • Preset

      private Preset​(Element preset)
      Load preset name and key-value pairs from XML Document.
  • Method Details

    • 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
    • size

      public int size()
      Get the number of settings in the preset.
      Since:
      3.4
    • getKeys

      public List<String> getKeys()
      Get all keys in this preset. The returned list is a copy of the settings and are not affected by later additions or removals.