Class EnumParam<T extends Enum<T>>

java.lang.Object
org.rwtodd.args.EnumParam<T>
All Implemented Interfaces:
NoArgParam, Param

public class EnumParam<T extends Enum<T>> extends Object implements NoArgParam
A parameter which gives options based on enum values. The right way to instantiate it is like this: new EnumParam<>(MyEnum.class, "help string").
  • Constructor Details

    • EnumParam

      public EnumParam(Class<T> c, T dflt, String help)
    • EnumParam

      public EnumParam(Class<T> c, String help)
      Create the EnumParam without a default (it will be null)
  • Method Details

    • 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
    • process

      public void process(String param) throws ArgParserException
      Description copied from interface: NoArgParam
      Process a parameter found on the command-line.
      Specified by:
      process in interface NoArgParam
      Parameters:
      param - the name of the parameter.
      Throws:
      ArgParserException - when there is a problem processing the parameter.
    • getValue

      public T getValue()