Class CmdLineOptions


  • public class CmdLineOptions
    extends Object
    Class to store the list of command line options
    See Also:
    CmdLineParser
    • Constructor Detail

      • CmdLineOptions

        public CmdLineOptions()
        Default constructor
    • Method Detail

      • add

        public void add​(CmdLineOption option)
        Method to add the command-line option
        Parameters:
        option - Command-line option
      • add

        public void add​(String name,
                        String altName,
                        int type,
                        boolean takesArg)
        Overloaded method to add the command-line option
        Parameters:
        name - Name of the option
        altName - Alternate name of the option
        type - Type of the option
        takesArg - Flag to indicate whether the option takes argument or not
      • getOption

        public CmdLineOption getOption​(String name)
        Method to get the standard option data by name
        Parameters:
        name - Name of the option
        Returns:
        Command-line option
      • getOption

        public CmdLineOption getOption​(int index)
        Method to get the standard option data by index
        Parameters:
        index - Index of the option
        Returns:
        Command-line option
      • getStringValue

        public String getStringValue​(String name)
        Method to get the value of the given option as String
        Parameters:
        name - Name of the option
        Returns:
        Value of the command-line option
      • getIntegerValue

        public Integer getIntegerValue​(String name,
                                       String errNamespace,
                                       int errCode)
                                throws OpenStegoException
        Method to get the value of the given option as integer
        Parameters:
        name - Name of the option
        errNamespace - Namespace to be used for exception in case of parsing error
        errCode - Error code to be used for exception in case of parsing error
        Returns:
        null if options is not present on command line, else integer value
        Throws:
        OpenStegoException - If value is provided but not an integer
      • getBooleanValue

        public Boolean getBooleanValue​(String name,
                                       String errNamespace,
                                       int errCode)
                                throws OpenStegoException
        Method to get the value of the given option as boolean. All boolean-y values like true, false, t, f, yes, no, y, n, 1, 0 are allowed (case insensitive)
        Parameters:
        name - Name of the option
        errNamespace - Namespace to be used for exception in case of parsing error
        errCode - Error code to be used for exception in case of parsing error
        Returns:
        null if options is not present on command line, else boolean value
        Throws:
        OpenStegoException - If value is provided but not boolean-y
      • getList

        public List<CmdLineOption> getList()
        Method to get the list of the given options
        Returns:
        List of options
      • size

        public int size()
        Method to get the number of the given options
        Returns:
        Number of options