Class ParamParser.Param

java.lang.Object
io.permazen.cli.ParamParser.Param
Enclosing class:
ParamParser

public class ParamParser.Param extends Object
Represents one parsed parameter specification.

String form is -flag:name:type, where the -flag is optional and indicates an option flag, name is the name of the flag or parameter, and type is optional as well: if missing, it indicates either an argument-less option flag, or a arbitrary string. Otherwise type is the name of a parameter type supported by ParamParser.getParser().

Non-option parameters may have a ? suffix if optional, or a +, or * suffix if repeatable, in which case the result is a List.

Spec string syntax examples:

  • -v:foo - boolean flag named foo
  • -v:foo:int - integer flag named foo
  • foo - string (word) parameter
  • foo:int - int parameter
  • foo? - optional final parameter
  • foo* - array of zero or more final parameters
  • foo+ - array of one or more final parameters
  • foo:int+ - array of one or more final int parameters
  • Constructor Details

    • Param

      public Param(String spec)
  • Method Details

    • getOptionFlag

      public String getOptionFlag()
    • isOption

      public boolean isOption()
    • getName

      public String getName()
    • getTypeName

      public String getTypeName()
    • getMin

      public int getMin()
    • getMax

      public int getMax()
    • getParser

      public Parser<?> getParser()
    • toString

      public String toString()
      Overrides:
      toString in class Object