Class AbstractCommandLineCompiler<T extends JobDescription>

  • Direct Known Subclasses:
    DefaultCommandLineCompiler

    public class AbstractCommandLineCompiler<T extends JobDescription>
    extends java.lang.Object
    An 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 boolean compilerWasUsed
      Whether the compiler was called.
      static int ERROR_MESSAGE_EXIT_CODE
      Exit code for compilation errors.
      protected ExitCodeHandler exitCodeHandler
      Used to manage calls to System.exit().
      static int INTERNAL_ERROR_EXIT_CODE
      Exit code for abnormal compiler behavior, such as violated invariants, infinite loops and the likes.
      protected T job
      The job to process: the inputs and the options.
      static int SUCCESS_EXIT_CODE
      Exit code for success (normal operation of the compiler, possibly with warnings and informational messages, but with no errors whatsoever).
      static int UNHANDLED_EXCEPTION_EXIT_CODE
      Exit code for unhandled exceptions (such as IOException).
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static void exitOnUnhandledException​(java.lang.Exception e, ExitCodeHandler exitCodeHandler)
      Prints a message announcing an unhandled exception and exits.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 an AbstractCommandLineCompiler.
        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.