org.appng.api.support

## Class OptionImpl

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

- All Implemented Interfaces:
    Option

      public class OptionImpl
      extends Object
      implements Option

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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OptionImpl(String name)`
    `OptionImpl(String name, Map<String,String> map)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `OptionImpl` | `addAttribute(String name, String value)`
    `OptionImpl` | `addMap(Map<String,String> map)`
    `boolean` | `containsAttribute(String name)` Checks whether this option has an attribute with the given name.
    `String` | `getAttribute(String name)` Returns the attribute with the given name, if present.
    `int` | `getAttributeAsInteger(String name)`
    `Map<String,String>` | `getAttributeMap()`
    `Set<String>` | `getAttributeNames()` Returns the names of all attributes of this option
    `Boolean` | `getBoolean(String name)` Returns a `Boolean` parsed from the attribute with the given name.
    `<E extends Enum<E>> E` | `getEnum(String name, Class<E> type)` Returns the `Enum` constant represented by the attribute with the given name.
    `Integer` | `getInteger(String name)` Returns an `Integer` parsed from the attribute with the given name.
    `String` | `getName()` Returns the name of this option.
    `String` | `getString(String name)` Returns the attribute with the given name, if present.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### OptionImpl

          public OptionImpl(String name)

    - #### OptionImpl

          public OptionImpl(String name,
                            Map<String,String> map)

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `Option`
      Returns the name of this option.
      Specified by:
        `getName` in interface `Option`
      Returns:
        the name of this option.

    - #### addMap

          public OptionImpl addMap(Map<String,String> map)

    - #### addAttribute

          public OptionImpl addAttribute(String name,
                                         String value)

    - #### containsAttribute

          public boolean containsAttribute(String name)

      Description copied from interface: `Option`
      Checks whether this option has an attribute with the given name.
      Specified by:
        `containsAttribute` in interface `Option`
      Parameters:
        `name` - the name of the attribute to check
      Returns:
        `true` if this option contains an attribute with the given name, `false` otherwise

    - #### getAttribute

          public String getAttribute(String name)

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

    - #### getAttributeAsInteger

          public int getAttributeAsInteger(String name)

    - #### getAttributeNames

          public Set<String> getAttributeNames()

      Description copied from interface: `Option`
      Returns the names of all attributes of this option
      Specified by:
        `getAttributeNames` in interface `Option`
      Returns:
        the names of all attributes

    - #### getAttributeMap

          public Map<String,String> getAttributeMap()

    - #### getString

          public String getString(String name)

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

    - #### getInteger

          public Integer getInteger(String name)

      Description copied from interface: `Option`
      Returns an `Integer` parsed from the attribute with the given name.
      Specified by:
        `getInteger` in interface `Option`
      Parameters:
        `name` - the name of the attribute to get
      Returns:
        the integer value, or `null` if no such attribute exists (or the value can not be parsed to an integer)

    - #### getBoolean

          public Boolean getBoolean(String name)

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

    - #### getEnum

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

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

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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