Package de.spraener.nxtgen
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 Summary
Modifier and TypeMethodDescriptionvoidaddCodeBlock(CodeBlock subBlock) add a CodeBlock to this code block.getName()get the Name of this code blockvoidAdd a single line to the code blockvoidsetToFileStrategy(ToFileStrategy strategy) toCode()Transform the CodeBlock to source code.voidwriteOutput(String workingDir)
-
Method Details
-
toCode
String toCode()Transform the CodeBlock to source code.- Returns:
- Source of the code block
-
println
Add a single line to the code block- Parameters:
txt- Some text to print into the codeblock
-
addCodeBlock
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
-
setToFileStrategy
-