Class AppendingParam<T>

java.lang.Object
org.rwtodd.args.AppendingParam<T>
All Implemented Interfaces:
OneArgParam<List<T>>, Param

public class AppendingParam<T> extends Object implements OneArgParam<List<T>>
  • Field Details

  • Constructor Details

    • AppendingParam

      public AppendingParam(OneArgParam<T> delegate, List<T> dflt)
      Construct a parameter.
      Parameters:
      delegate - a OneArgParam that we will delegate to for names and help strings and parsing
      dflt - the default, starting value of the parameter (any provided params will be appended it this).
    • AppendingParam

      public AppendingParam(OneArgParam<T> delegate)
      Construct a parameter that defaults to the empty list.
      Parameters:
      delegate - a OneArgParam that we will delegate to for names and help strings and parsing
  • Method Details

    • process

      public void process(String param, String argument) throws ArgParserException
      Description copied from interface: OneArgParam
      Process an parameter with its argument.
      Specified by:
      process in interface OneArgParam<T>
      Parameters:
      param - the name of the parameter, as it was found in the command-line.
      argument - the given argument to the parameter.
      Throws:
      ArgParserException - if there is a problem parsing the argument.
    • addToMap

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

      public void addHelp(PrintStream ps)
      adds help for this parameter to the given stream.
      Specified by:
      addHelp in interface Param
      Parameters:
      ps - the stream to use
    • getValue

      public List<T> getValue()
      gets the current value of the parameter
      Specified by:
      getValue in interface OneArgParam<T>