Class MultiCodeBlock

java.lang.Object
org.springframework.javapoet.support.MultiCodeBlock

public class MultiCodeBlock extends Object
A CodeBlock wrapper for joining multiple blocks.
Since:
6.0
Author:
Stephane Nicoll
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String code, Object... arguments)
    Add a code block using the specified formatted String and the specified arguments.
    void
    add(Consumer<org.springframework.javapoet.CodeBlock.Builder> code)
    Add a CodeBlock using the specified callback.
    void
    add(org.springframework.javapoet.CodeBlock code)
    Add the specified CodeBlock.
    org.springframework.javapoet.CodeBlock
    join(String delimiter)
    Return a CodeBlock that joins the different blocks registered in this instance with the specified delimiter.

    Methods inherited from class java.lang.Object

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

    • MultiCodeBlock

      public MultiCodeBlock()
  • Method Details

    • add

      public void add(org.springframework.javapoet.CodeBlock code)
      Add the specified CodeBlock.
      Parameters:
      code - the code block to add
    • add

      public void add(Consumer<org.springframework.javapoet.CodeBlock.Builder> code)
      Add a CodeBlock using the specified callback.
      Parameters:
      code - the callback to use
    • add

      public void add(String code, Object... arguments)
      Add a code block using the specified formatted String and the specified arguments.
      Parameters:
      code - the code
      arguments - the arguments
      See Also:
      • CodeBlock.Builder.add(String, Object...)
    • join

      public org.springframework.javapoet.CodeBlock join(String delimiter)
      Return a CodeBlock that joins the different blocks registered in this instance with the specified delimiter.
      Parameters:
      delimiter - the delimiter to use (not null)
      Returns:
      a CodeBlock joining the blocks of this instance with the specified delimiter
      See Also:
      • CodeBlock.join(Iterable, String)