Class OptionImpl

  • All Implemented Interfaces:
    Option

    public class OptionImpl
    extends Object
    implements Option
    The default implementation for Option
    Author:
    Matthias Herlitzius, Matthias Müller
    • 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.
      • 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)
      • 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
      • 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