Class SimpleStringCodeBlock

java.lang.Object
de.spraener.nxtgen.SimpleStringCodeBlock
All Implemented Interfaces:
CodeBlock
Direct Known Subclasses:
IndentationCodeBlock, SimpleFileWriterCodeBlock

public class SimpleStringCodeBlock extends Object implements CodeBlock
  • Constructor Details

    • SimpleStringCodeBlock

      public SimpleStringCodeBlock(String txt)
  • Method Details

    • toCode

      public String toCode()
      Description copied from interface: CodeBlock
      Transform the CodeBlock to source code.
      Specified by:
      toCode in interface CodeBlock
      Returns:
      Source of the code block
    • println

      public void println(String txt)
      Description copied from interface: CodeBlock
      Add a single line to the code block
      Specified by:
      println in interface CodeBlock
      Parameters:
      txt - Some text to print into the codeblock
    • addCodeBlock

      public void addCodeBlock(CodeBlock subBlock)
      Description copied from interface: CodeBlock
      add a CodeBlock to this code block.
      Specified by:
      addCodeBlock in interface CodeBlock
      Parameters:
      subBlock - a code block can contain other codeblocks. it is inserted at the current postion/line
    • getName

      public String getName()
      Description copied from interface: CodeBlock
      get the Name of this code block
      Specified by:
      getName in interface CodeBlock
      Returns:
      the unique name of the code block inside the generation context
    • writeOutput

      public void writeOutput(String workingDir)
      Specified by:
      writeOutput in interface CodeBlock
    • setToFileStrategy

      public void setToFileStrategy(ToFileStrategy strategy)
      Specified by:
      setToFileStrategy in interface CodeBlock