Class Main

java.lang.Object
com.google.googlejavaformat.java.Main

public final class Main extends Object
The main class for the Java formatter CLI.
  • Field Details

  • Constructor Details

  • Method Details

    • versionString

      static String versionString()
    • main

      public static void main(String... args)
      The main method for the formatter, with some number of file names to format. We process them in parallel, but we must be careful; if multiple file names refer to the same file (which is hard to determine), we must serialize their updates.
      Parameters:
      args - the command-line arguments
    • main

      static int main(InputStream in, PrintStream out, PrintStream err, String... args)
      Package-private main entry point used by the Tool implementation in the same package as this Main class.
    • main

      static int main(InputStream in, PrintWriter out, PrintWriter err, String... args)
      Package-private main entry point used by the ToolProvider implementation in the same package as this Main class.
    • format

      public int format(String... args) throws UsageException
      The main entry point for the formatter, with some number of file names to format. We process them in parallel, but we must be careful; if multiple file names refer to the same file (which is hard to determine), we must serialize their update.
      Parameters:
      args - the command-line arguments
      Throws:
      UsageException
    • formatFiles

      private int formatFiles(CommandLineOptions parameters, JavaFormatterOptions options)
    • formatStdin

      private int formatStdin(CommandLineOptions parameters, JavaFormatterOptions options)
    • processArgs

      public static CommandLineOptions processArgs(String... args) throws UsageException
      Parses and validates command-line flags.
      Throws:
      UsageException