Class ParsingContext


  • public class ParsingContext
    extends Object
    An iterator wrapping command line
    Author:
    Marko Strukelj
    • Constructor Detail

      • ParsingContext

        public ParsingContext​(String[] args)
      • ParsingContext

        public ParsingContext​(String[] args,
                              int offset)
      • ParsingContext

        public ParsingContext​(String[] args,
                              int offset,
                              int pos)
    • Method Detail

      • hasNext

        public boolean hasNext()
      • hasNext

        public boolean hasNext​(int count)
      • hasPrevious

        public boolean hasPrevious()
      • next

        public String next()
        Get next argument
        Returns:
        Next argument or null if beyond the end of arguments
      • nextRequired

        public String nextRequired()
        Check that a next argument is available
        Returns:
        Next argument or RuntimeException if next argument is not available
      • next

        public String next​(int n)
        Get next n-th argument
        Returns:
        Next n-th argument or null if beyond the end of arguments
      • previous

        public String previous()
        Get previous argument
        Returns:
        Previous argument or null if previous call was at the beginning of the arguments (pos == 0)
      • current

        public String current()
        Get current argument
        Returns:
        Current argument or null if current parsing position is beyond end, or before start
      • getArgs

        public String[] getArgs()