org.appng.api.support

## Class OptionsImpl

- java.lang.Object
- - org.appng.api.support.OptionsImpl

- All Implemented Interfaces:
    Options

      public class OptionsImpl
      extends Object
      implements Options

  The default implementation for `Options`
  Author:
    Matthias Herlitzius, Matthias Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,Option>` | `optionsMap`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OptionsImpl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOption(Option option)`
    `Boolean` | `getBoolean(String name, String attribute)` Returns a `Boolean` parsed from the attribute with the given name for the `Option` with the given name.
    `<E extends Enum<E>> E` | `getEnum(String name, String attribute, Class<E> type)` Returns the `Enum` constant of the given type represented by the attribute with the given name for the `Option` with the given name.
    `Integer` | `getInteger(String name, String attribute)` Returns an `Integer` parsed from the attribute with the given name for the `Option` with the given name.
    `Option` | `getOption(String name)` Returns the `Option` with the given name, if present.
    `Set<String>` | `getOptionNames()` Returns the names of all available `Option`s
    `String` | `getOptionValue(String optionName, String attributeName)` Returns the attribute with the given name for the `Option` with the given name.
    `String` | `getString(String name, String attribute)` Returns the attribute with the given name for the `Option` with the given name.
    `boolean` | `hasOption(String name)` Checks whether there is an `Option` with the given name.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### optionsMap

          protected Map<String,Option> optionsMap

  - ### Constructor Detail

    - #### OptionsImpl

          public OptionsImpl()

  - ### Method Detail

    - #### addOption

          public void addOption(Option option)

    - #### getOption

          public Option getOption(String name)

      Description copied from interface: `Options`
      Returns the `Option` with the given name, if present.
      Specified by:
        `getOption` in interface `Options`
      Parameters:
        `name` - the name of the `Option` to get
      Returns:
        the `Option` with the given name, if present, `null` otherwise

    - #### hasOption

          public boolean hasOption(String name)

      Description copied from interface: `Options`
      Checks whether there is an `Option` with the given name.
      Specified by:
        `hasOption` in interface `Options`
      Parameters:
        `name` - the name of the `Option` to check
      Returns:
        `true` there is an `Option` with the given name, `false` otherwise

    - #### getOptionNames

          public Set<String> getOptionNames()

      Description copied from interface: `Options`
      Returns the names of all available `Option`s
      Specified by:
        `getOptionNames` in interface `Options`
      Returns:
        the names of all available `Option`s

    - #### getOptionValue

          public String getOptionValue(String optionName,
                                       String attributeName)

      Description copied from interface: `Options`
      Returns the attribute with the given name for the `Option` with the given name.
      Specified by:
        `getOptionValue` in interface `Options`
      Parameters:
        `optionName` - the name of the `Option` to get the attribute from
        `attributeName` - the name of the attribute of the `Option`
      Returns:
        the attribute with the given name, or `null` if either the `Option` or the attribute does not exist

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getString

          public String getString(String name,
                                  String attribute)

      Description copied from interface: `Options`
      Returns the attribute with the given name for the `Option` with the given name.
      Specified by:
        `getString` in interface `Options`
      Parameters:
        `name` - the name of the `Option` to get the attribute from
        `attribute` - the name of the attribute of the `Option`
      Returns:
        the attribute with the given name, or `null` if either the `Option` or the attribute does not exist

    - #### getInteger

          public Integer getInteger(String name,
                                    String attribute)

      Description copied from interface: `Options`
      Returns an `Integer` parsed from the attribute with the given name for the `Option` with the given name.
      Specified by:
        `getInteger` in interface `Options`
      Parameters:
        `name` - the name of the `Option` to get the attribute from
        `attribute` - the name of the attribute of the `Option`
      Returns:
        the integer value, or `null` if either the `Option` or the attribute does not exist or the or the value can not be parsed to an integer

    - #### getBoolean

          public Boolean getBoolean(String name,
                                    String attribute)

      Description copied from interface: `Options`
      Returns a `Boolean` parsed from the attribute with the given name for the `Option` with the given name.
      Specified by:
        `getBoolean` in interface `Options`
      Parameters:
        `name` - the name of the `Option` to get the attribute from
        `attribute` - the name of the attribute of the `Option`
      Returns:
        `Boolean.TRUE` if the value of the attribute equals to (ignoring case) `true`, `Boolean.FALSE` otherwise (also if no such `Option` exists)

    - #### getEnum

          public <E extends Enum<E>> E getEnum(String name,
                                               String attribute,
                                               Class<E> type)

      Description copied from interface: `Options`
      Returns the `Enum` constant of the given type represented by the attribute with the given name for the `Option` with the given name.
      Specified by:
        `getEnum` in interface `Options`
      Parameters:
        `name` - the name of the `Option` to get the attribute from
        `attribute` - the name of the attribute of the `Option`
      Returns:
        the enum constant, if the (upper-case) attribute value represents a valid enum of the given type, `null` otherwise (also if no such `Option` exists)

Copyright © 2011–2023 aiticon GmbH. All rights reserved.