Package com.google.googlejavaformat.java
Class Main
- java.lang.Object
-
- com.google.googlejavaformat.java.Main
-
public final class Main extends java.lang.ObjectThe main class for the Java formatter CLI.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.PrintWritererrWriterprivate java.io.InputStreaminStreamprivate static intMAX_THREADSprivate java.io.PrintWriteroutWriterprivate static java.lang.StringSTDIN_FILENAME
-
Constructor Summary
Constructors Constructor Description Main(java.io.PrintWriter outWriter, java.io.PrintWriter errWriter, java.io.InputStream inStream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intformat(java.lang.String... args)The main entry point for the formatter, with some number of file names to format.private intformatFiles(CommandLineOptions parameters, JavaFormatterOptions options)private intformatStdin(CommandLineOptions parameters, JavaFormatterOptions options)(package private) static intmain(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err, java.lang.String... args)Package-private main entry point used by theToolimplementation in the same package as this Main class.(package private) static intmain(java.io.InputStream in, java.io.PrintWriter out, java.io.PrintWriter err, java.lang.String... args)Package-private main entry point used by theToolProviderimplementation in the same package as this Main class.static voidmain(java.lang.String... args)The main method for the formatter, with some number of file names to format.static CommandLineOptionsprocessArgs(java.lang.String... args)Parses and validates command-line flags.(package private) static java.lang.StringversionString()
-
-
-
Field Detail
-
MAX_THREADS
private static final int MAX_THREADS
- See Also:
- Constant Field Values
-
STDIN_FILENAME
private static final java.lang.String STDIN_FILENAME
- See Also:
- Constant Field Values
-
outWriter
private final java.io.PrintWriter outWriter
-
errWriter
private final java.io.PrintWriter errWriter
-
inStream
private final java.io.InputStream inStream
-
-
Method Detail
-
versionString
static java.lang.String versionString()
-
main
public static void main(java.lang.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(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err, java.lang.String... args)Package-private main entry point used by theToolimplementation in the same package as this Main class.
-
main
static int main(java.io.InputStream in, java.io.PrintWriter out, java.io.PrintWriter err, java.lang.String... args)Package-private main entry point used by theToolProviderimplementation in the same package as this Main class.
-
format
public int format(java.lang.String... args) throws UsageExceptionThe 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(java.lang.String... args) throws UsageException
Parses and validates command-line flags.- Throws:
UsageException
-
-