Interface CodeBlock

All Known Implementing Classes:
BlueprintCodeBlock, CodeBlockImpl, CodeTargetCodeBlockAdapter, GroovyCodeBlockImpl, IndentationCodeBlock, JavaCodeBlock, SimpleFileWriterCodeBlock, SimpleStringCodeBlock

public interface CodeBlock
A CodeBlock is a recursive structure to hold all blocks that together build a peace of generated code. It is the result of a CodeGenerator.rsolve Method call.
  • Method Details

    • toCode

      String toCode()
      Transform the CodeBlock to source code.
      Returns:
      Source of the code block
    • println

      void println(String txt)
      Add a single line to the code block
      Parameters:
      txt - Some text to print into the codeblock
    • addCodeBlock

      void addCodeBlock(CodeBlock subBlock)
      add a CodeBlock to this code block.
      Parameters:
      subBlock - a code block can contain other codeblocks. it is inserted at the current postion/line
    • getName

      String getName()
      get the Name of this code block
      Returns:
      the unique name of the code block inside the generation context
    • writeOutput

      void writeOutput(String workingDir)
    • setToFileStrategy

      void setToFileStrategy(ToFileStrategy strategy)