Class DefaultCompiledObjectDecorator

java.lang.Object
jaxx.compiler.decorators.DefaultCompiledObjectDecorator
All Implemented Interfaces:
CompiledObjectDecorator
Direct Known Subclasses:
BoxedCompiledObjectDecorator, HelpRootCompiledObjectDecorator

@Component(role=CompiledObjectDecorator.class,
           hint="default")
public class DefaultCompiledObjectDecorator
extends java.lang.Object
implements CompiledObjectDecorator
The default decorator to use on all compiled objects.
Since:
1.2
Author:
Tony Chemit - chemit@codelutin.com
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected static org.apache.commons.logging.Log log
    Logger
  • Constructor Summary

    Constructors
    Constructor Description
    DefaultCompiledObjectDecorator()  
  • Method Summary

    Modifier and Type Method Description
    protected void addClientProperties​(CompiledObject object, java.lang.StringBuilder code, java.lang.String eol)  
    java.lang.String createCompleteSetupMethod​(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile)
    Obtain the setup code of the given object from the compiler to be inject in the generated method $completeSetup.
    boolean createInitializer​(JAXXCompiler compiler, CompiledObject root, CompiledObject object, java.lang.StringBuilder code, boolean lastWasMethodCall)
    Create the initializer code for the given compiled object and inject it in the code.
    void finalizeCompiler​(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, java.lang.String packageName, java.lang.String className, java.lang.String fullClassName)
    Finalize the given compiled object before any generation in the file.
    java.lang.String getCreationCode​(JAXXCompiler compiler, CompiledObject object)
    Obtain the creation code of the given object from the compiler to inject in generate method $initialize or createXXX in not inline.
    java.lang.String getName()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • log

      protected static final org.apache.commons.logging.Log log
      Logger
  • Constructor Details

    • DefaultCompiledObjectDecorator

      public DefaultCompiledObjectDecorator()
  • Method Details

    • getName

      public java.lang.String getName()
      Specified by:
      getName in interface CompiledObjectDecorator
      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, java.lang.String packageName, java.lang.String className, java.lang.String fullClassName) throws java.lang.ClassNotFoundException
      Description copied from interface: CompiledObjectDecorator
      Finalize the given compiled object before any generation in the file.
      Specified by:
      finalizeCompiler in interface CompiledObjectDecorator
      Parameters:
      compiler - the compiler to use
      root - the root compiled object of the jaxx file
      object - the compiled object to treate
      javaFile - the file to treate
      packageName - the package name
      className - the (simple ?) class name
      fullClassName - the fully class name
      Throws:
      java.lang.ClassNotFoundException - if a class is not found
    • getCreationCode

      public java.lang.String getCreationCode​(JAXXCompiler compiler, CompiledObject object) throws CompilerException
      Description copied from interface: CompiledObjectDecorator
      Obtain the creation code of the given object from the compiler to inject in generate method $initialize or createXXX in not inline.
      Specified by:
      getCreationCode in interface CompiledObjectDecorator
      Parameters:
      compiler - the compiler to use
      object - 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 java.lang.String createCompleteSetupMethod​(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile)
      Description copied from interface: CompiledObjectDecorator
      Obtain the setup code of the given object from the compiler to be inject in the generated method $completeSetup.
      Specified by:
      createCompleteSetupMethod in interface CompiledObjectDecorator
      Parameters:
      compiler - the compiler to use
      object - the compiled object to treate
      javaFile - the file to treate
      Returns:
      the code to inject in $completeSetup method in file
    • createInitializer

      public boolean createInitializer​(JAXXCompiler compiler, CompiledObject root, CompiledObject object, java.lang.StringBuilder code, boolean lastWasMethodCall)
      Description copied from interface: CompiledObjectDecorator
      Create the initializer code for the given compiled object and inject it in the code.
      Specified by:
      createInitializer in interface CompiledObjectDecorator
      Parameters:
      compiler - the compiler to use
      root - the root compiled object of the jaxx file
      object - the compiled object to treate
      code - where to store code to inject
      lastWasMethodCall - true if last instruction call was a method call
      Returns:
      true if the last instruction was a method call
    • addClientProperties

      protected void addClientProperties​(CompiledObject object, java.lang.StringBuilder code, java.lang.String eol)