KotlinPrinter

class KotlinPrinter(packageName: String, fileAnnotations: List<String>, defaultImports: List<String>, indentSize: Int)

Types

Imports
Link copied to clipboard
class Imports(codePackageName: String, defaultImports: List<String>)

Functions

append
Link copied to clipboard
fun append(str: String): KotlinPrinter
Appends a string
block
Link copied to clipboard
fun block(block: String): KotlinPrinter
Appends a block.
divider
Link copied to clipboard
fun divider(pattern: String = "/", size: Int = 120): KotlinPrinter
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
import
Link copied to clipboard
fun TypeName.import(): String
Generates a short name for the given TypeNameRecord the proper import for the type.
fun MType.import(): String
Generates a short name for the given MTypeRecord the proper import for the type.
fun TypeName.import(function: String): String
Imports a top level function, returns the shortened name
fun MType.import(function: String): String
Imports a top level function, returns the shortened name
indent
Link copied to clipboard
fun indent(block: KotlinPrinter.() -> Unit)
Increases the indent for everything added by the block
line
Link copied to clipboard
fun line(str: String): KotlinPrinter
Appends a string followed by a newline
newline
Link copied to clipboard
fun newline(): KotlinPrinter
Appends a string followed by a line break
toString
Link copied to clipboard
open override fun toString(): String
Returns the resulting code