Class OptParse<E>


  • public class OptParse<E>
    extends java.lang.Object
    util to parse command-line arguments
    Version:
    4.7
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  OptParse.OptHandler<E>
      a class to handle one option
    • Constructor Summary

      Constructors 
      Constructor Description
      OptParse()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addHandler​(OptParse.OptHandler<E> handler)
      add a handler for some option
      void exitParsing()
      a handler can call this to interrupt the parsing
      E parse​(java.lang.String[] args, E e)  
      void printHelp()
      print help of all options
      void setHelp​(java.lang.String helpString)
      change the main help string, which will be printed if asked, or if a wrong option is given
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • realArgs

        public java.lang.String[] realArgs
      • mainHelp

        private java.lang.String mainHelp
    • Constructor Detail

      • OptParse

        public OptParse()
    • Method Detail

      • addHandler

        public void addHandler​(OptParse.OptHandler<E> handler)
        add a handler for some option
        Parameters:
        handler - the handler
      • setHelp

        public void setHelp​(java.lang.String helpString)
        change the main help string, which will be printed if asked, or if a wrong option is given
        Parameters:
        helpString - the help string
      • parse

        public E parse​(java.lang.String[] args,
                       E e)
      • printHelp

        public void printHelp()
        print help of all options
      • exitParsing

        public void exitParsing()
        a handler can call this to interrupt the parsing