kotlinpoet / com.squareup.kotlinpoet

Package com.squareup.kotlinpoet

Types

AnnotationSpec class AnnotationSpec

A generated annotation on a declaration.

ArrayTypeName class ArrayTypeName : TypeName
ClassName class ClassName : TypeName, Comparable<ClassName>

A fully-qualified class name for top-level and member classes.

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!

FunSpec class FunSpec

A generated function declaration.

KModifier enum class KModifier
KotlinFile class KotlinFile

A Kotlin file containing top level objects like classes, objects, functions, properties, and type aliases.

NameAllocator class NameAllocator : Cloneable

Assigns Kotlin identifier names to avoid collisions, keywords, and invalid characters. To use, first create an instance and allocate all of the names that you need. Typically this is a mix of user-supplied names and constants:

ParameterSpec class ParameterSpec

A generated parameter declaration.

ParameterizedTypeName class ParameterizedTypeName : TypeName
PropertySpec class PropertySpec

A generated property declaration.

TypeName abstract class TypeName

Any type in Kotlin's type system. This class identifies simple types like Int and String, nullable types like Int?, composite types like Array<String> and Set<String>, and unassignable types like Unit.

TypeSpec class TypeSpec

A generated class, interface, or enum declaration.

TypeVariableName class TypeVariableName : TypeName
WildcardTypeName class WildcardTypeName : TypeName

Properties

ANY val ANY: ClassName
BOOLEAN val BOOLEAN: ClassName
BYTE val BYTE: ClassName
CHAR val CHAR: ClassName
DOUBLE val DOUBLE: ClassName
FLOAT val FLOAT: ClassName
INT val INT: ClassName
LONG val LONG: ClassName
SHORT val SHORT: ClassName
UNIT val UNIT: ClassName