Class CommandLineOptionsParser


  • final class CommandLineOptionsParser
    extends java.lang.Object
    A parser for CommandLineOptions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static com.google.common.base.Splitter ARG_SPLITTER  
      private static com.google.common.base.Splitter COLON_SPLITTER  
      private static com.google.common.base.Splitter COMMA_SPLITTER  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void expandParamsFiles​(java.lang.Iterable<java.lang.String> args, java.util.List<java.lang.String> expanded)
      Pre-processes an argument list, expanding arguments of the form @filename by reading the content of the file and appending whitespace-delimited options to arguments.
      private static java.lang.String getValue​(java.lang.String flag, java.util.Iterator<java.lang.String> it, java.lang.String value)  
      (package private) static CommandLineOptions parse​(java.lang.Iterable<java.lang.String> options)
      private static java.lang.Integer parseInteger​(java.util.Iterator<java.lang.String> it, java.lang.String flag, java.lang.String value)  
      private static com.google.common.collect.Range<java.lang.Integer> parseRange​(java.lang.String arg)
      Parse a range, as in "1:12" or "42".
      private static void parseRangeSet​(com.google.common.collect.RangeSet<java.lang.Integer> result, java.lang.String ranges)
      Parse multiple --lines flags, like {"1:12,14,20:36", "40:45,50"}.
      • Methods inherited from class java.lang.Object

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

      • COMMA_SPLITTER

        private static final com.google.common.base.Splitter COMMA_SPLITTER
      • COLON_SPLITTER

        private static final com.google.common.base.Splitter COLON_SPLITTER
      • ARG_SPLITTER

        private static final com.google.common.base.Splitter ARG_SPLITTER
    • Constructor Detail

      • CommandLineOptionsParser

        CommandLineOptionsParser()
    • Method Detail

      • parseInteger

        private static java.lang.Integer parseInteger​(java.util.Iterator<java.lang.String> it,
                                                      java.lang.String flag,
                                                      java.lang.String value)
      • getValue

        private static java.lang.String getValue​(java.lang.String flag,
                                                 java.util.Iterator<java.lang.String> it,
                                                 java.lang.String value)
      • parseRangeSet

        private static void parseRangeSet​(com.google.common.collect.RangeSet<java.lang.Integer> result,
                                          java.lang.String ranges)
        Parse multiple --lines flags, like {"1:12,14,20:36", "40:45,50"}. Multiple ranges can be given with multiple --lines flags or separated by commas. A single line can be set by a single number. Line numbers are 1-based, but are converted to the 0-based numbering used internally by google-java-format.
      • parseRange

        private static com.google.common.collect.Range<java.lang.Integer> parseRange​(java.lang.String arg)
        Parse a range, as in "1:12" or "42". Line numbers provided are 1-based, but are converted here to 0-based.
      • expandParamsFiles

        private static void expandParamsFiles​(java.lang.Iterable<java.lang.String> args,
                                              java.util.List<java.lang.String> expanded)
        Pre-processes an argument list, expanding arguments of the form @filename by reading the content of the file and appending whitespace-delimited options to arguments.