Interface Param

All Known Subinterfaces:
NoArgParam, OneArgParam
All Known Implementing Classes:
AccumulatingParam, BasicNoArgParam, BasicOneArgParam, BoundedIntParam, ClampedIntParam, DoubleParam, EnumParam, ExistingDirectoryParam, ExistingFileParam, FlagParam, IntListParam, IntParam, StringParam

public sealed interface Param permits OneArgParam, NoArgParam
Interface for command-line parameter specs. The two subclasses are for parameters that are expected on the command-line. One can also define Param instances that merely group and format other parameters as part of help text.
  • Method Details

    • addToMap

      void addToMap(Map<String,Param> map)
      Add the parameter's names to a Map<String,Param>.
      Parameters:
      map - the Map to which our names should be added.
    • addHelp

      void addHelp(PrintStream ps)
      adds help for this parameter to the given stream.
      Parameters:
      ps - the stream to use
    • formatNames

      static String formatNames(Collection<String> names)
      A helper function to format a list of parameter names. It adds the appropriate number of dashes before the names, and separates them.
      Parameters:
      names - the collection of parameter names.
      Returns:
      a formatted string
    • formatTypicalHelp

      static void formatTypicalHelp(PrintStream ps, String nameLine, String descline)
      A helper function to format a typical parameter. It uses one line for the names, and an indented line for the description. Descriptions longer than 72 characters are split across lines. At present, the splitting code doesn't try to cut the lines off at word boundaries... just straight 72-length lines are used. The algorithm may improve in the future.
      Parameters:
      ps - the PrintStream to write to.
      nameLine - the line of code for the names, perhaps generated by formatNames(Collection).
      descline - the description text for the parameter.