Class ToolsOption

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class ToolsOption
    extends org.apache.commons.cli.Option
    Class that extends Apache's Option class. Provides a simpler interface to build command-line option flags.
    Author:
    jpadams
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.commons.cli.Option

        org.apache.commons.cli.Option.Builder
    • Field Summary

      • Fields inherited from class org.apache.commons.cli.Option

        UNINITIALIZED, UNLIMITED_VALUES
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void hasArg​(String name, Object type)
      Requires a single argument to follow the option.
      void hasArg​(String name, Object type, boolean isOptional)
      Allows a single argument to be passed into the option.
      void hasArgs​(int numArgs, String name, Object type, char separator, boolean isOptional)
      Defines an argument's "properties" for an option.
      void hasArgs​(String name, Object type)
      Requires an argument to follow the option.
      void hasArgs​(String name, Object type, char separator)
      Requires an argument to follow the option.
      void hasArgs​(String name, Object type, char separator, boolean isOptional)
      Allows multiple arguments to be passed in to the option.
      • Methods inherited from class org.apache.commons.cli.Option

        addValue, builder, builder, clone, equals, getArgName, getArgs, getConverter, getDeprecated, getDescription, getId, getKey, getLongOpt, getOpt, getSince, getType, getValue, getValue, getValue, getValues, getValueSeparator, getValuesList, hasArg, hasArgName, hasArgs, hashCode, hasLongOpt, hasOptionalArg, hasValueSeparator, isDeprecated, isRequired, setArgName, setArgs, setConverter, setDescription, setLongOpt, setOptionalArg, setRequired, setType, setType, setValueSeparator, toString
    • Constructor Detail

      • ToolsOption

        public ToolsOption​(Flag flag)
        Constructor.
        Parameters:
        flag - An object representation of the command-line flag option.
      • ToolsOption

        public ToolsOption​(String opt,
                           String longOpt,
                           String description)
        Constructor.
        Parameters:
        opt - Short name of the option.
        longOpt - Long name of the option. Can be set to 'null'.
        description - Description of the option.
    • Method Detail

      • hasArg

        public void hasArg​(String name,
                           Object type)
        Requires a single argument to follow the option.
        Parameters:
        name - Sets the display name of the argument value.
        type - Sets the data type allowed for this argument.
      • hasArg

        public void hasArg​(String name,
                           Object type,
                           boolean isOptional)
        Allows a single argument to be passed into the option.
        Parameters:
        name - Sets the display name of the argument value.
        type - Sets the data type allowed for this argument.
        isOptional - Set to 'true' if the argument is optional, 'false' otherwise.
      • hasArgs

        public void hasArgs​(int numArgs,
                            String name,
                            Object type,
                            char separator,
                            boolean isOptional)
        Defines an argument's "properties" for an option.
        Parameters:
        numArgs - Max number of arguments allowed.
        name - Sets the display name of the argument value.
        type - Sets the data type allowed for this argument.
        separator - Sets the separator value allowed in between the argument values being passed in.
        isOptional - Set to 'true' if an argument is optional, 'false' otherwise.
      • hasArgs

        public void hasArgs​(String name,
                            Object type)
        Requires an argument to follow the option. This method allows the option to take in multiple arguments. Does not define a maximum number of allowable arguments. The separator value is set to the space character ' '.
        Parameters:
        name - Sets the display name of the argument value.
        type - Sets the data type allowed for this argument.
      • hasArgs

        public void hasArgs​(String name,
                            Object type,
                            char separator)
        Requires an argument to follow the option. Allows multiple arguments to be passed in to the option. Does not define a maximum number of allowable arguments.
        Parameters:
        name - Sets the display name of the argument value.
        type - Sets the data type allowed for this argument.
        separator - Sets the separator value allowed in between the argument values being passed in.
      • hasArgs

        public void hasArgs​(String name,
                            Object type,
                            char separator,
                            boolean isOptional)
        Allows multiple arguments to be passed in to the option. Does not define a maximum number of allowable arguments.
        Parameters:
        name - Sets the display name of the argument value.
        type - Sets the data type allowed for this argument.
        separator - Sets the separator value allowed in between the argument values being passed in.
        isOptional - Set to 'true' if an argument is optional, 'false' otherwise.