kotlinpoet / com.squareup.kotlinpoet / FunSpec

FunSpec

class FunSpec : Taggable, OriginatingElementsHolder

A generated function declaration.

Types

Builder

class Builder : Taggable.Builder<FunSpec.Builder>, OriginatingElementsHolder.Builder<FunSpec.Builder>

Properties

annotations

val annotations: List<AnnotationSpec>

body

val body: CodeBlock

delegateConstructor

val delegateConstructor: String?

delegateConstructorArguments

val delegateConstructorArguments: List<CodeBlock>

isAccessor

val isAccessor: Boolean

isConstructor

val isConstructor: Boolean

kdoc

val kdoc: CodeBlock

modifiers

val modifiers: Set<KModifier>

name

val name: String

parameters

val parameters: List<ParameterSpec>

receiverKdoc

val receiverKdoc: CodeBlock

receiverType

val receiverType: TypeName?

returnKdoc

val returnKdoc: CodeBlock

returnType

val returnType: TypeName?

typeVariables

val typeVariables: List<TypeVariableName>

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

toBuilder

fun toBuilder(): FunSpec.Builder

toString

fun toString(): String

Companion Object Functions

builder

fun builder(name: String): FunSpec.Builder

constructorBuilder

fun constructorBuilder(): FunSpec.Builder

getterBuilder

fun getterBuilder(): FunSpec.Builder

overriding

fun overriding(method: ExecutableElement): FunSpec.Builder

Returns a new fun spec builder that overrides method.

fun overriding(method: ExecutableElement, enclosing: DeclaredType, types: Types): FunSpec.Builder

Returns a new function spec builder that overrides method as a member of enclosing. This will resolve type parameters: for example overriding Comparable.compareTo in a type that implements Comparable<Movie>, the T parameter will be resolved to Movie.

setterBuilder

fun setterBuilder(): FunSpec.Builder

Extension Functions

tag

fun <T : Any> Taggable.tag(): T?

Returns the tag attached with T as a key, or null if no tag is attached with that key.