Package org.nuiton.jaxx.compiler
Interface CompiledObjectDecorator
-
- All Known Implementing Classes:
BoxedCompiledObjectDecorator,DefaultCompiledObjectDecorator
public interface CompiledObjectDecoratorContract of compiled object decorator at generation time. Note : The implementation of this class must be stateless.- Since:
- 1.2
- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringcreateCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile)Obtain the setup code of the givenobjectfrom thecompilerto be inject in the generated method$completeSetup.booleancreateInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuilder code, boolean lastWasMethodCall)Create the initializer code for the given compiledobjectand inject it in thecode.voidfinalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName)Finalize the given compiled object before any generation in thefile.StringgetCreationCode(JAXXCompiler compiler, CompiledObject object)Obtain the creation code of the givenobjectfrom thecompilerto inject in generate method$initializeorcreateXXXin not inline.StringgetName()
-
-
-
Method Detail
-
getName
String getName()
- Returns:
- the name of the decorator (match the content of a decorator attribute value in a JAXX file)
-
createCompleteSetupMethod
String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile)
Obtain the setup code of the givenobjectfrom thecompilerto be inject in the generated method$completeSetup.- Parameters:
compiler- the compiler to useobject- the compiled object to treatejavaFile- the file to treate- Returns:
- the code to inject in $completeSetup method in file
-
createInitializer
boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuilder code, boolean lastWasMethodCall)
Create the initializer code for the given compiledobjectand inject it in thecode.- Parameters:
compiler- the compiler to useroot- the root compiled object of the jaxx fileobject- the compiled object to treatecode- where to store code to injectlastWasMethodCall-trueif last instruction call was a method call- Returns:
trueif the last instruction was a method call
-
finalizeCompiler
void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) throws ClassNotFoundException
Finalize the given compiled object before any generation in thefile.- Parameters:
compiler- the compiler to useroot- the root compiled object of the jaxx fileobject- the compiled object to treatejavaFile- the file to treatepackageName- the package nameclassName- the (simple ?) class namefullClassName- the fully class name- Throws:
ClassNotFoundException- if a class is not found
-
getCreationCode
String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException
Obtain the creation code of the givenobjectfrom thecompilerto inject in generate method$initializeorcreateXXXin not inline.- Parameters:
compiler- the compiler to useobject- the compiled object to treate- Returns:
- the code to inject in $initialize (or in the createXXX in not inline) method to create the given object
- Throws:
CompilerException- if any pb
-
-