Class OptionsImpl

  • All Implemented Interfaces:
    Options

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