kotlinpoet / com.squareup.kotlinpoet / CodeBlock

CodeBlock

class CodeBlock

A fragment of a .kt file, potentially containing declarations, statements, and documentation. Code blocks are not necessarily well-formed Kotlin code, and are not validated. This class assumes kotlinc will check correctness later!

Code blocks support placeholders like java.text.Format. This class uses a percent sign % but has its own set of permitted placeholders:

Types

Builder class Builder

Functions

equals fun equals(other: Any?): Boolean
hashCode fun hashCode(): Int
isEmpty fun isEmpty(): Boolean
toBuilder fun toBuilder(): Builder
toString fun toString(): String

Companion Object Functions

builder fun builder(): Builder
of fun of(format: String, vararg args: Any?): CodeBlock