Class DefaultCompiledObjectDecorator
- java.lang.Object
-
- org.nuiton.jaxx.compiler.decorators.DefaultCompiledObjectDecorator
-
- All Implemented Interfaces:
CompiledObjectDecorator
- Direct Known Subclasses:
BoxedCompiledObjectDecorator
@AutoService(CompiledObjectDecorator.class) @Component(hint="default", role=CompiledObjectDecorator.class) public class DefaultCompiledObjectDecorator extends Object implements CompiledObjectDecorator
The default decorator to use on all compiled objects.- Since:
- 1.2
- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.logging.log4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description DefaultCompiledObjectDecorator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddClientProperties(CompiledObject object, StringBuilder code, String eol)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
public String getName()
- Specified by:
getNamein interfaceCompiledObjectDecorator- Returns:
- the name of the decorator (match the content of a decorator attribute value in a JAXX file)
-
finalizeCompiler
public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) throws ClassNotFoundException
Description copied from interface:CompiledObjectDecoratorFinalize the given compiled object before any generation in thefile.- Specified by:
finalizeCompilerin interfaceCompiledObjectDecorator- 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
public String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException
Description copied from interface:CompiledObjectDecoratorObtain the creation code of the givenobjectfrom thecompilerto inject in generate method$initializeorcreateXXXin not inline.- Specified by:
getCreationCodein interfaceCompiledObjectDecorator- 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
-
createCompleteSetupMethod
public String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile)
Description copied from interface:CompiledObjectDecoratorObtain the setup code of the givenobjectfrom thecompilerto be inject in the generated method$completeSetup.- Specified by:
createCompleteSetupMethodin interfaceCompiledObjectDecorator- 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
public boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuilder code, boolean lastWasMethodCall)
Description copied from interface:CompiledObjectDecoratorCreate the initializer code for the given compiledobjectand inject it in thecode.- Specified by:
createInitializerin interfaceCompiledObjectDecorator- 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
-
addClientProperties
protected void addClientProperties(CompiledObject object, StringBuilder code, String eol)
-
-