Class OptionCollectionParser<T extends UIOption<T>>

java.lang.Object
org.apache.rat.OptionCollectionParser<T>
Type Parameters:
T - The UIOption type that this parser is handling.

public final class OptionCollectionParser<T extends UIOption<T>> extends Object
Uses the AbstractOptionCollection to parse the command line options. Contains utility methods to ReportConfiguration from the options and an array of arguments.
  • Constructor Details

    • OptionCollectionParser

      public OptionCollectionParser(UIOptionCollection<T> optionCollection)
      Constructor.
      Parameters:
      optionCollection - the option collection to use for.
  • Method Details

    • parseCommands

      public ArgumentContext parseCommands(File workingDirectory, String[] args) throws RatException
      Parses the standard options to create a ReportConfiguration.
      Parameters:
      workingDirectory - the directory to resolve relative file names against.
      args - the arguments to parse.
      Returns:
      the ArgumentContext for the process.
      Throws:
      RatException - on error.
    • parseCommandLine

      public static org.apache.commons.cli.CommandLine parseCommandLine(org.apache.commons.cli.Options opts, String[] args) throws org.apache.commons.cli.ParseException
      Parse the options into the command line.
      Parameters:
      opts - the option definitions.
      args - the argument to apply the definitions to.
      Returns:
      the CommandLine
      Throws:
      org.apache.commons.cli.ParseException - on option parsing error.