kotlinpoet / com.squareup.kotlinpoet / TypeSpec

TypeSpec

class TypeSpec

A generated class, interface, or enum declaration.

Types

Builder

class Builder

Kind

enum class Kind

Properties

annotations

val annotations: List<AnnotationSpec>

anonymousTypeArguments

val anonymousTypeArguments: CodeBlock?

companionObject

val companionObject: TypeSpec?

enumConstants

val enumConstants: Map<String, TypeSpec>

funSpecs

val funSpecs: List<FunSpec>

initializerBlock

val initializerBlock: CodeBlock

kdoc

val kdoc: CodeBlock

kind

val kind: Kind

modifiers

val modifiers: Set<KModifier>

name

val name: String?

primaryConstructor

val primaryConstructor: FunSpec?

propertySpecs

val propertySpecs: List<PropertySpec>

superclass

val superclass: TypeName

superclassConstructorParameters

val superclassConstructorParameters: List<CodeBlock>

superinterfaces

val superinterfaces: Map<TypeName, CodeBlock?>

Map of superinterfaces - entries with a null value represent a regular superinterface (with no delegation), while non-null CodeBlock values represent delegates for the corresponding TypeSpec interface (key) value

typeSpecs

val typeSpecs: List<TypeSpec>

typeVariables

val typeVariables: List<TypeVariableName>

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

toBuilder

fun toBuilder(): Builder

toString

fun toString(): String

Companion Object Functions

annotationBuilder

fun annotationBuilder(name: String): Builder
fun annotationBuilder(className: ClassName): Builder

anonymousClassBuilder

fun anonymousClassBuilder(): Builder
fun anonymousClassBuilder(typeArgumentsFormat: String, vararg args: Any): Builder

classBuilder

fun classBuilder(name: String): Builder
fun classBuilder(className: ClassName): Builder

companionObjectBuilder

fun companionObjectBuilder(name: String? = null): Builder

enumBuilder

fun enumBuilder(name: String): Builder
fun enumBuilder(className: ClassName): Builder

expectClassBuilder

fun expectClassBuilder(name: String): Builder
fun expectClassBuilder(className: ClassName): Builder

interfaceBuilder

fun interfaceBuilder(name: String): Builder
fun interfaceBuilder(className: ClassName): Builder

objectBuilder

fun objectBuilder(name: String): Builder
fun objectBuilder(className: ClassName): Builder