Interface CodeBlock.FormattingOptions

Enclosing class:
CodeBlock

public static interface CodeBlock.FormattingOptions
Strategy interface to customize formatting of generated code block.
Author:
Stephane Nicoll
  • Method Details

    • statementSeparator

      String statementSeparator()
      Return the separator to use to end a statement.
      Returns:
      the statement separator
    • arrayOf

      CodeBlock arrayOf(CodeBlock... values)
      Return the code that represents an array annotation attribute value for the specified values. Implementations may omit the array syntax for a single value if the language allows it.
      Parameters:
      values - the values of the array
      Returns:
      the code for the specified values
    • classReference

      CodeBlock classReference(ClassName className)
      Return the code that represents a reference to the specified ClassName. For instance with java, a reference to com.example.Test would be Test.class.
      Parameters:
      className - the class name to handle
      Returns:
      a class reference to the specified class name
    • nestedAnnotation

      default CodeBlock nestedAnnotation(ClassName className)
      Return the code that starts an annotation used as an attribute value of another annotation. For instance with java, a nested com.example.Test annotation would start with @Test.
      Parameters:
      className - the class name of the nested annotation
      Returns:
      the start of the nested annotation