All Known Implementing Classes:
ArgumentParser.CmdLineImpl

@ClassVersion(sourceVersion="$Id: Parameters.java 1049 2023-02-25 19:13:40Z tquadrat $") @API(status=STABLE, since="0.1.0") public interface Parameters

Provides access to a list of arguments on the command line.

Objects that implement this interface are passed to an instance of CmdLineValueHandler to make it safe and easy to parse additional parameters for options.

Author:
Thomas Thrien (thomas.thrien@tquadrat.org)
Version:
$Id: Parameters.java 1049 2023-02-25 19:13:40Z tquadrat $
Since:
0.1.0
UML Diagram
UML Diagram for "org.tquadrat.foundation.config.spi.Parameters"

UML Diagram for "org.tquadrat.foundation.config.spi.Parameters"

UML Diagram for "org.tquadrat.foundation.config.spi.Parameters"
  • Method Summary

    Modifier and Type
    Method
    Description
    getParameter(int index)
    Returns the additional parameter to a related option.
    boolean
    isParameter(int index)
    Tests whether the given index is for an additional parameter to a related option.
  • Method Details

    • getParameter

      Returns the additional parameter to a related option.

      Specifying 0 for index will retrieve the token next to the option. For example, if the command line looks like

      -o abc -d x

      then getParameter(0) for the option "-o" returns "abc"; getParameter(1) would return "-d", but as this is an option, a CmdLineException will be thrown instead.

      Parameters:
      index - The index for the requested parameter; must be 0 or greater.
      Returns:
      The requested parameter.
      Throws:
      CmdLineException - An attempt is made to access a non-existent index, or the index is for a non-parameter entry on the command line.
    • isParameter

      @API(status=STABLE, since="0.1.2") boolean isParameter(int index)

      Tests whether the given index is for an additional parameter to a related option. The first additional parameter has the index 0, a second one will have 1 and so on.

      Assume the command line looks like this:

      -o abc def -d x

      Then isParameter(0) and isParameter(1) would return true, but isParameter(3) returns false: x is an additional parameter, but for the option -d in this case.

      Parameters:
      index - The index for the requested parameter; must be 0 or greater.
      Returns:
      true if the argument at the given location is an additional parameter for the current option, false if not.
      Since:
      0.1.2