Package com.google.common.css
Class AbstractCommandLineCompiler<T extends JobDescription>
- java.lang.Object
-
- com.google.common.css.AbstractCommandLineCompiler<T>
-
- Direct Known Subclasses:
DefaultCommandLineCompiler
public class AbstractCommandLineCompiler<T extends JobDescription> extends java.lang.ObjectAn abstract class that is designed to be extended by classes that provide a command line interface to the CSS parser.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancompilerWasUsedWhether the compiler was called.static intERROR_MESSAGE_EXIT_CODEExit code for compilation errors.protected ExitCodeHandlerexitCodeHandlerUsed to manage calls to System.exit().static intINTERNAL_ERROR_EXIT_CODEExit code for abnormal compiler behavior, such as violated invariants, infinite loops and the likes.protected TjobThe job to process: the inputs and the options.static intSUCCESS_EXIT_CODEExit code for success (normal operation of the compiler, possibly with warnings and informational messages, but with no errors whatsoever).static intUNHANDLED_EXCEPTION_EXIT_CODEExit code for unhandled exceptions (such as IOException).
-
Constructor Summary
Constructors Constructor Description AbstractCommandLineCompiler(T job, ExitCodeHandler exitCodeHandler)Constructs anAbstractCommandLineCompiler.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidexitOnUnhandledException(java.lang.Exception e, ExitCodeHandler exitCodeHandler)Prints a message announcing an unhandled exception and exits.
-
-
-
Field Detail
-
SUCCESS_EXIT_CODE
public static final int SUCCESS_EXIT_CODE
Exit code for success (normal operation of the compiler, possibly with warnings and informational messages, but with no errors whatsoever).- See Also:
- Constant Field Values
-
ERROR_MESSAGE_EXIT_CODE
public static final int ERROR_MESSAGE_EXIT_CODE
Exit code for compilation errors. The compiler processed the input normally, but the input was wrong in some way.- See Also:
- Constant Field Values
-
UNHANDLED_EXCEPTION_EXIT_CODE
public static final int UNHANDLED_EXCEPTION_EXIT_CODE
Exit code for unhandled exceptions (such as IOException).- See Also:
- Constant Field Values
-
INTERNAL_ERROR_EXIT_CODE
public static final int INTERNAL_ERROR_EXIT_CODE
Exit code for abnormal compiler behavior, such as violated invariants, infinite loops and the likes.- See Also:
- Constant Field Values
-
job
protected final T extends JobDescription job
The job to process: the inputs and the options.
-
compilerWasUsed
protected boolean compilerWasUsed
Whether the compiler was called. We don't allow calling it twice.
-
exitCodeHandler
protected final ExitCodeHandler exitCodeHandler
Used to manage calls to System.exit().
-
-
Constructor Detail
-
AbstractCommandLineCompiler
public AbstractCommandLineCompiler(T job, ExitCodeHandler exitCodeHandler)
Constructs anAbstractCommandLineCompiler.- Parameters:
job- the inputs the compiler should process and the options to use
-
-
Method Detail
-
exitOnUnhandledException
protected static void exitOnUnhandledException(java.lang.Exception e, ExitCodeHandler exitCodeHandler)Prints a message announcing an unhandled exception and exits.
-
-