Package org.nuiton.jaxx.compiler
Class JAXXEngine
- java.lang.Object
-
- org.nuiton.jaxx.compiler.JAXXEngine
-
-
Field Summary
Fields Modifier and Type Field Description protected List<JAXXCompilerFile>compilingFilesFiles to compileprotected CompilerConfigurationconfigurationconfiguration of the launchor and underlines compilersprotected JAXXEngineTaskcurrentTaskcurrent pass of the engineprotected List<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 List<String>warningsWarnings detected while running.
-
Constructor Summary
Constructors Modifier Constructor Description protectedJAXXEngine(CompilerConfiguration configuration, File base, String... relativePaths)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(String error)Add an error to the engine.voidaddFileToCompile(File jaxxFile, String jaxxClassName)Adds aJAXXCompilerFilegiven the jaxx file and the corresponding class fully qualified name.voidaddFileToCompile(JAXXCompilerFile file)Adds afileto be compiled.voidaddProfileTime(JAXXCompiler compiler, String key)Add a profile time for the given compiler and key.voidaddWarning(String warning)Add a warning to the engine.voidclearReports()booleancontainsJaxxFileClassName(String className)voidflushI18nGetterFile()JAXXCompilerFile[]getCompiledFiles()CompilerConfigurationgetConfiguration()CompiledObjectDecoratorgetDecorator(Class<?> type)Obtain the decorator of the given type.CompiledObjectDecoratorgetDecorator(String name)Obtain the decorator of the given name.List<String>getErrors()JAXXCompilerFile[]getFilesToCompile()I18nKeysFileModelgetI18nKeysFileModel(String fqn, boolean loadIfNotFound)JAXXCompilergetJAXXCompiler(String className)Obtain the jaxx compiler of the given class name.JAXXCompilerFilegetJAXXCompilerFile(String className)Obtain the jaxx compiler of the given class name.JAXXProfilegetProfiler()JAXXEngineTask[]getTasks()Class<?>getValidatorFactory()ClassDescriptorgetValidatorFactoryClass()StringgetVersion()List<String>getWarnings()booleanisCompileFirstPassTask()booleanisVerbose()JAXXCompilernewCompiler(JAXXCompilerFile jaxxFile)Create a new compiler and attach it to the givenjaxxFile.voidregisterI18nKey(String key)protected voidreset(boolean cleanReports)Resets all state in preparation for a new compilation session.intrun()Compiled a set of files.
-
-
-
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)
-
compilingFiles
protected final List<JAXXCompilerFile> compilingFiles
Files to compile
-
tasks
protected JAXXEngineTask[] tasks
tasks to launch
-
currentTask
protected JAXXEngineTask currentTask
current pass of the engine
-
profiler
protected JAXXProfile profiler
profile attached to the engine (can be null)
-
-
Constructor Detail
-
JAXXEngine
protected JAXXEngine(CompilerConfiguration configuration, File base, String... relativePaths)
-
-
Method Detail
-
getTasks
public JAXXEngineTask[] getTasks()
-
getProfiler
public JAXXProfile getProfiler()
-
getConfiguration
public CompilerConfiguration getConfiguration()
-
getFilesToCompile
public JAXXCompilerFile[] getFilesToCompile()
-
getCompiledFiles
public JAXXCompilerFile[] getCompiledFiles()
-
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(String name) throws IllegalArgumentException
Obtain the decorator of the given name.- Parameters:
name- the name of the decorator- Returns:
- the decorator found.
- Throws:
IllegalArgumentException- if decorator not found for the given name.
-
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:
-1if errors appears, the number of generated files otherwise.
-
addFileToCompile
public void addFileToCompile(JAXXCompilerFile file)
Adds afileto be compiled.- Parameters:
file- theJAXXCompilerFileto add.
-
addFileToCompile
public void addFileToCompile(File jaxxFile, 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
public JAXXCompiler newCompiler(JAXXCompilerFile jaxxFile) throws Exception
Create a new compiler and attach it to the givenjaxxFile.- 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
profilerisnull, do nothing- Parameters:
compiler- the compiler to profilekey- the key of profiling
-
registerI18nKey
public void registerI18nKey(String key)
-
flushI18nGetterFile
public void flushI18nGetterFile() throws IOException- Throws:
IOException
-
getValidatorFactory
public Class<?> getValidatorFactory()
-
getValidatorFactoryClass
public ClassDescriptor getValidatorFactoryClass()
-
getI18nKeysFileModel
public I18nKeysFileModel getI18nKeysFileModel(String fqn, boolean loadIfNotFound)
-
-