kotlinpoet / com.squareup.kotlinpoet

Package com.squareup.kotlinpoet

Types

AnnotationSpec

class AnnotationSpec

A generated annotation on a declaration.

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!

FileSpec

class FileSpec

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

FunSpec

class FunSpec

A generated function declaration.

KModifier

enum class KModifier

LambdaTypeName

class LambdaTypeName : TypeName

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.

TypeAliasSpec

class TypeAliasSpec

A generated typealias 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

Extensions for External Classes

java.lang.Class

java.lang.reflect.ParameterizedType

java.lang.reflect.Type

java.lang.reflect.WildcardType

javax.lang.model.element.TypeElement

javax.lang.model.element.TypeParameterElement

javax.lang.model.type.TypeMirror

javax.lang.model.type.TypeVariable

javax.lang.model.type.WildcardType

kotlin.collections.Collection

kotlin.reflect.KClass

Properties

ANY

val ANY: ClassName

ARRAY

val ARRAY: 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