Exemplo n.º 1
0
  /**
   * Retrieve the value of an option.
   *
   * @param id a string uniquely identifying the option
   * @return its value or null, if not found
   */
  public String getOption(String id) {

    assert (id != null);
    assert (fStorage != null);

    for (ICStorageElement child : fStorage.getChildrenByName("option")) {

      if (child.hasAttribute("id") && id.equals(child.getAttribute("id"))) {
        return child.getAttribute("value");
      }
    }

    return null;
  }
Exemplo n.º 2
0
  /**
   * Retrieve a map with all properties.
   *
   * @return a map of strings.
   */
  public Map<String, String> getOptions() {

    assert (fStorage != null);

    Map<String, String> map = new HashMap<String, String>();

    for (ICStorageElement child : fStorage.getChildrenByName("option")) {

      if (child.hasAttribute("id")) {
        map.put(child.getAttribute("id"), child.getAttribute("value"));
      }
    }

    return map;
  }