Class JAXXEngine


  • public class JAXXEngine
    extends Object
    The engine to compile jaxx files.

    The method run() launch the compilation of files.

    Since:
    2.0.0 was previously JAXXCompilerLaunchor
    Author:
    Tony Chemit - dev@tchemit.fr
    • Field Detail

      • configuration

        protected final CompilerConfiguration configuration
        configuration of the launchor and underlines compilers
      • incomingFiles

        protected final JAXXCompilerFile[] incomingFiles
        original list of files to compile (says the detected modfied files)
      • warnings

        protected final List<String> warnings
        Warnings detected while running.
      • errors

        protected final List<String> errors
        Errors detected while running.
      • currentTask

        protected JAXXEngineTask currentTask
        current pass of the engine
      • profiler

        protected JAXXProfile profiler
        profile attached to the engine (can be null)
    • Method Detail

      • getErrors

        public List<String> getErrors()
        Returns:
        the errors of the engine
      • getWarnings

        public List<String> getWarnings()
        Returns:
        the warnings of the engine
      • containsJaxxFileClassName

        public boolean containsJaxxFileClassName​(String className)
      • isCompileFirstPassTask

        public boolean isCompileFirstPassTask()
      • reset

        protected void reset​(boolean cleanReports)
        Resets all state in preparation for a new compilation session.
        Parameters:
        cleanReports - should we also clean reports ?
      • clearReports

        public void clearReports()
      • getVersion

        public String getVersion()
      • getJAXXCompilerFile

        public JAXXCompilerFile getJAXXCompilerFile​(String className)
        Obtain the jaxx compiler of the given class name.
        Parameters:
        className - the name of the class to use
        Returns:
        the compiler instance which is processing the specified JAXX class. Each class is compiled by a different compiler instance.
      • getJAXXCompiler

        public JAXXCompiler getJAXXCompiler​(String className)
        Obtain the jaxx compiler of the given class name.
        Parameters:
        className - the name of the class to use
        Returns:
        the compiler instance which is processing the specified JAXX class. Each class is compiled by a different compiler instance.
      • getDecorator

        public CompiledObjectDecorator getDecorator​(Class<?> type)
        Obtain the decorator of the given type.
        Parameters:
        type - the type of the decorator (syas his fqn)
        Returns:
        the decorator found
      • addWarning

        public void addWarning​(String warning)
        Add a warning to the engine.
        Parameters:
        warning - the warning to add
      • addError

        public void addError​(String error)
        Add an error to the engine.
        Parameters:
        error - the error to add
      • run

        public int run()
        Compiled a set of files.
        Returns:
        -1 if errors appears, the number of generated files otherwise.
      • addFileToCompile

        public void addFileToCompile​(File jaxxFile,
                                     String jaxxClassName)
        Adds a JAXXCompilerFile given the jaxx file and the corresponding class fully qualified name.
        Parameters:
        jaxxFile - the jaxx file location
        jaxxClassName - the fully qualified name of the jaxx class
      • newCompiler

        public JAXXCompiler newCompiler​(JAXXCompilerFile jaxxFile)
                                 throws Exception
        Create a new compiler and attach it to the given jaxxFile.
        Parameters:
        jaxxFile - the definition of jaxx file to compile
        Returns:
        the new compiler
        Throws:
        Exception - if any pb while creating of compiler
      • isVerbose

        public boolean isVerbose()
      • addProfileTime

        public void addProfileTime​(JAXXCompiler compiler,
                                   String key)
        Add a profile time for the given compiler and key.

        Note: if profiler is null, do nothing

        Parameters:
        compiler - the compiler to profile
        key - the key of profiling
      • registerI18nKey

        public void registerI18nKey​(String key)
      • getValidatorFactory

        public Class<?> getValidatorFactory()
      • getValidatorFactoryClass

        public ClassDescriptor getValidatorFactoryClass()