Package-level declarations
Types
A spec or type which can be annotated.
A generated annotation on a declaration.
A fully-qualified class name for top-level and member classes.
A KotlinPoet spec type that can have a context receiver.
Marks declarations in the KotlinPoet API that are delicate — they have limited use-case and shall be used with care in general code. Any use of a delicate declaration has to be carefully reviewed to make sure it is properly used and does not create problems like lossy Java -> Kotlin type parsing. Carefully read documentation and message of any declaration marked as DelicateKotlinPoetApi
.
A spec which contains documentation.
Indicates that a given API is experimental and subject to change.
A Kotlin file containing top level objects like classes, objects, functions, properties, and type aliases.
A generated function declaration.
Represents the name of a member (such as a function or a property).
A spec which can contain PropertySpecs and FunSpecs.
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:
A type that can have originating elements.
A generated parameter declaration.
A generated property declaration.
A generated typealias declaration
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
.
A generated class, interface, or enum declaration.
A spec which can contain other TypeSpec
Properties
The wildcard type *
which is shorthand for out Any?
.
Functions
Returns the class name for element
.
Returns a parameterized type equivalent to type
.
Returns a TypeName equivalent to this TypeMirror.
Returns a TypeName equivalent to the given Kotlin KType using reflection, maybe using kotlin-reflect if required.
Returns type variable equivalent to element
.
Returns type variable equivalent to mirror
.
Builds new CodeBlock by populating newly created CodeBlock.Builder using provided builderAction and then converting it to CodeBlock.
Join each CodeBlock in this into a single CodeBlock using separator with an optional prefix and suffix.
Returns the tag attached with T as a key, or null if no tag is attached with that key.
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.
Calls CodeBlock.Builder.indent then executes the provided builderAction on the CodeBlock.Builder and then executes CodeBlock.Builder.unindent before returning the original CodeBlock.Builder.