Home

kotlinpoet / com.squareup.kotlinpoet

Package com.squareup.kotlinpoet

Types

Name Summary
AnnotationSpec A generated annotation on a declaration.class AnnotationSpec :Taggable
ClassName A fully-qualified class name for top-level and member classes.class ClassName :TypeName,Comparable<ClassName>
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!class CodeBlock
Dynamic object Dynamic :TypeName
FileSpec A Kotlin file containing top level objects like classes, objects, functions, properties, and type aliases.class FileSpec :Taggable
FunSpec A generated function declaration.class FunSpec :Taggable,OriginatingElementsHolder
KModifier enum class KModifier
LambdaTypeName class LambdaTypeName :TypeName
MemberName Represents the name of a member (such as a function or a property).data class MemberName
NameAllocator 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:class NameAllocator
OriginatingElementsHolder A type that can have originating elements.interface OriginatingElementsHolder
ParameterizedTypeName class ParameterizedTypeName :TypeName
ParameterSpec A generated parameter declaration.class ParameterSpec :Taggable
PropertySpec A generated property declaration.class PropertySpec :Taggable,OriginatingElementsHolder
Taggable A type that can be tagged with extra metadata of the user’s choice.interface Taggable
TypeAliasSpec A generated typealias declarationclass TypeAliasSpec :Taggable
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.sealed class TypeName :Taggable
TypeSpec A generated class, interface, or enum declaration.class TypeSpec :Taggable,OriginatingElementsHolder
TypeVariableName class TypeVariableName :TypeName
WildcardTypeName class WildcardTypeName :TypeName

Extensions for External Classes

Name Summary
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
kotlin.reflect.KType
kotlin.reflect.KTypeParameter

Properties

Name Summary
ANNOTATION val ANNOTATION:ClassName
ANY val ANY:ClassName
ARRAY val ARRAY:ClassName
BOOLEAN val BOOLEAN:ClassName
BOOLEAN_ARRAY val BOOLEAN_ARRAY:ClassName
BYTE val BYTE:ClassName
BYTE_ARRAY val BYTE_ARRAY:ClassName
CHAR val CHAR:ClassName
CHAR_ARRAY val CHAR_ARRAY:ClassName
CHAR_SEQUENCE val CHAR_SEQUENCE:ClassName
COLLECTION val COLLECTION:ClassName
COMPARABLE val COMPARABLE:ClassName
DOUBLE val DOUBLE:ClassName
DOUBLE_ARRAY val DOUBLE_ARRAY:ClassName
DYNAMIC Dynamic is a singleton object type, so this is a shorthand for it in Java.val DYNAMIC:Dynamic
ENUM val ENUM:ClassName
FLOAT val FLOAT:ClassName
FLOAT_ARRAY val FLOAT_ARRAY:ClassName
INT val INT:ClassName
INT_ARRAY val INT_ARRAY:ClassName
ITERABLE val ITERABLE:ClassName
LIST val LIST:ClassName
LONG val LONG:ClassName
LONG_ARRAY val LONG_ARRAY:ClassName
MAP val MAP:ClassName
MAP_ENTRY val MAP_ENTRY:ClassName
MUTABLE_COLLECTION val MUTABLE_COLLECTION:ClassName
MUTABLE_ITERABLE val MUTABLE_ITERABLE:ClassName
MUTABLE_LIST val MUTABLE_LIST:ClassName
MUTABLE_MAP val MUTABLE_MAP:ClassName
MUTABLE_MAP_ENTRY val MUTABLE_MAP_ENTRY:ClassName
MUTABLE_SET val MUTABLE_SET:ClassName
NOTHING val NOTHING:ClassName
NUMBER val NUMBER:ClassName
SET val SET:ClassName
SHORT val SHORT:ClassName
SHORT_ARRAY val SHORT_ARRAY:ClassName
STAR The wildcard type * which is shorthand for out Any?.val STAR:WildcardTypeName
STRING val STRING:ClassName
THROWABLE val THROWABLE:ClassName
U_BYTE val U_BYTE:ClassName
U_BYTE_ARRAY val U_BYTE_ARRAY:ClassName
U_INT val U_INT:ClassName
U_INT_ARRAY val U_INT_ARRAY:ClassName
U_LONG val U_LONG:ClassName
U_LONG_ARRAY val U_LONG_ARRAY:ClassName
U_SHORT val U_SHORT:ClassName
U_SHORT_ARRAY val U_SHORT_ARRAY:ClassName
UNIT val UNIT:ClassName

Functions

Name Summary
buildCodeBlock Builds new CodeBlock by populating newly created CodeBlock.Builder using provided builderAction and then converting it to CodeBlock.fun buildCodeBlock(builderAction: Builder.() ->Unit):CodeBlock
tag Returns the tag attached with T as a key, or null if no tag is attached with that key.fun <T :Any>Taggable.tag(): T?
Attaches tag to the request using T as a key. Tags can be read from a request using Taggable.tag. Use null to remove any existing tag assigned for T.fun <T :Any> Builder.tag(tag: T?): Builder
fun <T :Any> Builder.tag(tag: T?): Builder
fun <T :Any> Builder.tag(tag: T?): Builder
fun <T :Any> Builder.tag(tag: T?): Builder
fun <T :Any> Builder.tag(tag: T?): Builder
fun <T :Any> Builder.tag(tag: T?): Builder
fun <T :Any> Builder.tag(tag: T?): Builder
typeNameOf fun <T> typeNameOf():TypeName