Package jaxx.compiler
Class JAXXEngine
java.lang.Object
jaxx.compiler.JAXXEngine
public class JAXXEngine
extends java.lang.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 - chemit@codelutin.com
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<JAXXCompilerFile>compilingFilesFiles to compileprotected CompilerConfigurationconfigurationconfiguration of the launchor and underlines compilersprotected JAXXEngineTaskcurrentTaskcurrent pass of the engineprotected java.util.List<java.lang.String>errorsErrors detected while running.protected JAXXCompilerFile[]incomingFilesoriginal list of files to compile (says the detected modfied files)protected JAXXProfileprofilerprofile attached to the engine (can be null)protected JAXXEngineTask[]taskstasks to launchprotected java.util.List<java.lang.String>warningsWarnings detected while running. -
Constructor Summary
Constructors Modifier Constructor Description protectedJAXXEngine(CompilerConfiguration configuration, java.io.File base, java.lang.String... relativePaths) -
Method Summary
Modifier and Type Method Description voidaddError(java.lang.String error)Add an error to the engine.voidaddFileToCompile(java.io.File jaxxFile, java.lang.String jaxxClassName)Adds aJAXXCompilerFilegiven the jaxx file and the corresponding class fully qualified name.voidaddFileToCompile(JAXXCompilerFile file)Adds afileto be compiled.voidaddProfileTime(JAXXCompiler compiler, java.lang.String key)Add a profile time for the given compiler and key.voidaddWarning(java.lang.String warning)Add a warning to the engine.voidclearReports()booleancontainsJaxxFileClassName(java.lang.String className)JAXXCompilerFile[]getCompiledFiles()CompilerConfigurationgetConfiguration()CompiledObjectDecoratorgetDecorator(java.lang.Class<?> type)Obtain the decorator of the given type.CompiledObjectDecoratorgetDecorator(java.lang.String name)Obtain the decorator of the given name.java.util.List<java.lang.String>getErrors()JAXXCompilerFile[]getFilesToCompile()JAXXCompilerFile[]getIncomingFiles()JAXXCompilergetJAXXCompiler(java.lang.String className)Obtain the jaxx compiler of the given class name.JAXXCompilerFilegetJAXXCompilerFile(java.lang.String className)Obtain the jaxx compiler of the given class name.JAXXProfilegetProfiler()SymbolTablegetSymbolTable(java.lang.String className)Obtain the symbo table for the given class name.JAXXEngineTask[]getTasks()java.lang.StringgetVersion()java.util.List<java.lang.String>getWarnings()booleanisCompileFirstPassTask()booleanisVerbose()JAXXCompilernewCompiler(JAXXCompilerFile jaxxFile)Create a new compiler and attach it to the givenjaxxFile.protected voidreset(boolean cleanReports)Resets all state in preparation for a new compilation session.intrun()Compiled a set of files.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
configuration
configuration of the launchor and underlines compilers -
incomingFiles
original list of files to compile (says the detected modfied files) -
compilingFiles
Files to compile -
warnings
protected final java.util.List<java.lang.String> warningsWarnings detected while running. -
errors
protected final java.util.List<java.lang.String> errorsErrors detected while running. -
tasks
tasks to launch -
currentTask
current pass of the engine -
profiler
profile attached to the engine (can be null)
-
-
Constructor Details
-
JAXXEngine
protected JAXXEngine(CompilerConfiguration configuration, java.io.File base, java.lang.String... relativePaths)
-
-
Method Details
-
getTasks
-
getErrors
public java.util.List<java.lang.String> getErrors()- Returns:
- the errors of the engine
-
getWarnings
public java.util.List<java.lang.String> getWarnings()- Returns:
- the warnings of the engine
-
getProfiler
-
getConfiguration
-
getIncomingFiles
-
getFilesToCompile
-
getCompiledFiles
-
containsJaxxFileClassName
public boolean containsJaxxFileClassName(java.lang.String className) -
isCompileFirstPassTask
public boolean isCompileFirstPassTask() -
reset
protected void reset(boolean cleanReports)Resets all state in preparation for a new compilation session. -
clearReports
public void clearReports() -
getVersion
public java.lang.String getVersion() -
getJAXXCompilerFile
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
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.
-
getSymbolTable
Obtain the symbo table for the given class name.- Parameters:
className- the name of the class to use- Returns:
- the symbol table for the specified JAXX class.
Must be called during the second compiler pass.
Returns
nullif no such symbol table could be found.
-
getDecorator
public CompiledObjectDecorator getDecorator(java.lang.String name) throws java.lang.IllegalArgumentExceptionObtain the decorator of the given name.- Parameters:
name- the name of the decorator- Returns:
- the decorator found.
- Throws:
java.lang.IllegalArgumentException- if decorator not found for the given name.
-
getDecorator
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(java.lang.String warning)Add a warning to the engine.- Parameters:
warning- the warning to add
-
addError
public void addError(java.lang.String error)Add an error to the engine.- Parameters:
error- the error to add
-
run
public int run()Compiled a set of files.- Returns:
-1if errors appears, the number of generated files otherwise.
-
addFileToCompile
Adds afileto be compiled.- Parameters:
file- theJAXXCompilerFileto add.
-
addFileToCompile
public void addFileToCompile(java.io.File jaxxFile, java.lang.String jaxxClassName)Adds aJAXXCompilerFilegiven the jaxx file and the corresponding class fully qualified name.- Parameters:
jaxxFile- the jaxx file locationjaxxClassName- the fully qualified name of the jaxx class
-
newCompiler
Create a new compiler and attach it to the givenjaxxFile.- Parameters:
jaxxFile- the definition of jaxx file to compile- Returns:
- the new compiler
- Throws:
java.lang.Exception- if any pb while creating of compiler
-
isVerbose
public boolean isVerbose() -
addProfileTime
Add a profile time for the given compiler and key. Note: ifprofilerisnull, do nothing- Parameters:
compiler- the compiler to profilekey- the key of profiling
-