Class CommandLineOptions

java.lang.Object
com.google.googlejavaformat.java.CommandLineOptions

final class CommandLineOptions extends Object
Command line options for google-java-format.

google-java-format doesn't depend on AutoValue, to allow AutoValue to depend on google-java-format.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
     
    private final Optional<String>
     
    private final boolean
     
    private final com.google.common.collect.ImmutableList<String>
     
    private final boolean
     
    private final boolean
     
    private final boolean
     
    private final boolean
     
    private final com.google.common.collect.ImmutableList<Integer>
     
    private final com.google.common.collect.ImmutableRangeSet<Integer>
     
    private final com.google.common.collect.ImmutableList<Integer>
     
    private final boolean
     
    private final boolean
     
    private final boolean
     
    private final boolean
     
    private final boolean
     
    private final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CommandLineOptions(com.google.common.collect.ImmutableList<String> files, boolean inPlace, com.google.common.collect.ImmutableRangeSet<Integer> lines, com.google.common.collect.ImmutableList<Integer> offsets, com.google.common.collect.ImmutableList<Integer> lengths, boolean aosp, boolean version, boolean help, boolean stdin, boolean fixImportsOnly, boolean sortImports, boolean removeUnusedImports, boolean dryRun, boolean setExitIfChanged, Optional<String> assumeFilename, boolean reflowLongStrings, boolean formatJavadoc)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) boolean
    Use AOSP style instead of Google Style (4-space indentation).
    (package private) Optional<String>
    Return the name to use for diagnostics when formatting standard input.
    (package private) static CommandLineOptions.Builder
     
    (package private) boolean
    Print the paths of the files whose contents would change if the formatter were run normally.
    (package private) com.google.common.collect.ImmutableList<String>
    The files to format.
    (package private) boolean
    Fix imports, but do no formatting.
    (package private) boolean
     
    (package private) boolean
    Print usage information.
    (package private) boolean
    Format files in place.
    (package private) boolean
    Returns true if partial formatting was selected.
    (package private) com.google.common.collect.ImmutableList<Integer>
    Partial formatting region lengths, paired with offsets.
    (package private) com.google.common.collect.ImmutableRangeSet<Integer>
    Line ranges to format.
    (package private) com.google.common.collect.ImmutableList<Integer>
    Character offsets for partial formatting, paired with lengths.
    (package private) boolean
     
    (package private) boolean
    Remove unused imports.
    (package private) boolean
    Return exit code 1 if there are any formatting changes.
    (package private) boolean
    Sort imports.
    (package private) boolean
    Format input from stdin.
    (package private) boolean
    Print the version.

    Methods inherited from class java.lang.Object

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

    • files

      private final com.google.common.collect.ImmutableList<String> files
    • inPlace

      private final boolean inPlace
    • lines

      private final com.google.common.collect.ImmutableRangeSet<Integer> lines
    • offsets

      private final com.google.common.collect.ImmutableList<Integer> offsets
    • lengths

      private final com.google.common.collect.ImmutableList<Integer> lengths
    • aosp

      private final boolean aosp
    • version

      private final boolean version
    • help

      private final boolean help
    • stdin

      private final boolean stdin
    • fixImportsOnly

      private final boolean fixImportsOnly
    • sortImports

      private final boolean sortImports
    • removeUnusedImports

      private final boolean removeUnusedImports
    • dryRun

      private final boolean dryRun
    • setExitIfChanged

      private final boolean setExitIfChanged
    • assumeFilename

      private final Optional<String> assumeFilename
    • reflowLongStrings

      private final boolean reflowLongStrings
    • formatJavadoc

      private final boolean formatJavadoc
  • Constructor Details

    • CommandLineOptions

      CommandLineOptions(com.google.common.collect.ImmutableList<String> files, boolean inPlace, com.google.common.collect.ImmutableRangeSet<Integer> lines, com.google.common.collect.ImmutableList<Integer> offsets, com.google.common.collect.ImmutableList<Integer> lengths, boolean aosp, boolean version, boolean help, boolean stdin, boolean fixImportsOnly, boolean sortImports, boolean removeUnusedImports, boolean dryRun, boolean setExitIfChanged, Optional<String> assumeFilename, boolean reflowLongStrings, boolean formatJavadoc)
  • Method Details

    • files

      com.google.common.collect.ImmutableList<String> files()
      The files to format.
    • inPlace

      boolean inPlace()
      Format files in place.
    • lines

      com.google.common.collect.ImmutableRangeSet<Integer> lines()
      Line ranges to format.
    • offsets

      com.google.common.collect.ImmutableList<Integer> offsets()
      Character offsets for partial formatting, paired with lengths.
    • lengths

      com.google.common.collect.ImmutableList<Integer> lengths()
      Partial formatting region lengths, paired with offsets.
    • aosp

      boolean aosp()
      Use AOSP style instead of Google Style (4-space indentation).
    • version

      boolean version()
      Print the version.
    • help

      boolean help()
      Print usage information.
    • stdin

      boolean stdin()
      Format input from stdin.
    • fixImportsOnly

      boolean fixImportsOnly()
      Fix imports, but do no formatting.
    • sortImports

      boolean sortImports()
      Sort imports.
    • removeUnusedImports

      boolean removeUnusedImports()
      Remove unused imports.
    • dryRun

      boolean dryRun()
      Print the paths of the files whose contents would change if the formatter were run normally.
    • setExitIfChanged

      boolean setExitIfChanged()
      Return exit code 1 if there are any formatting changes.
    • assumeFilename

      Optional<String> assumeFilename()
      Return the name to use for diagnostics when formatting standard input.
    • reflowLongStrings

      boolean reflowLongStrings()
    • isSelection

      boolean isSelection()
      Returns true if partial formatting was selected.
    • formatJavadoc

      boolean formatJavadoc()
    • builder

      static CommandLineOptions.Builder builder()