kotlinpoet / com.squareup.kotlinpoet / PropertySpec / Builder

Builder

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

Properties

annotations

val annotations: MutableList<AnnotationSpec>

modifiers

val modifiers: MutableList<KModifier>

originatingElements

val originatingElements: MutableList<Element>

Mutable map of the current originating elements this builder contains.

tags

val tags: MutableMap<KClass<*>, Any>

Mutable map of the current tags this builder contains.

typeVariables

val typeVariables: MutableList<TypeVariableName>

Functions

addAnnotation

fun addAnnotation(annotationSpec: AnnotationSpec): PropertySpec.Builder
fun addAnnotation(annotation: ClassName): PropertySpec.Builder
fun addAnnotation(annotation: Class<*>): PropertySpec.Builder
fun addAnnotation(annotation: KClass<*>): PropertySpec.Builder

addAnnotations

fun addAnnotations(annotationSpecs: Iterable<AnnotationSpec>): PropertySpec.Builder

addKdoc

fun addKdoc(format: String, vararg args: Any): PropertySpec.Builder
fun addKdoc(block: CodeBlock): PropertySpec.Builder

addModifiers

fun addModifiers(vararg modifiers: KModifier): PropertySpec.Builder

addTypeVariable

fun addTypeVariable(typeVariable: TypeVariableName): PropertySpec.Builder

addTypeVariables

fun addTypeVariables(typeVariables: Iterable<TypeVariableName>): PropertySpec.Builder

build

fun build(): PropertySpec

delegate

fun delegate(format: String, vararg args: Any?): PropertySpec.Builder
fun delegate(codeBlock: CodeBlock): PropertySpec.Builder

getter

fun getter(getter: FunSpec): PropertySpec.Builder

initializer

fun initializer(format: String, vararg args: Any?): PropertySpec.Builder
fun initializer(codeBlock: CodeBlock): PropertySpec.Builder

mutable

fun mutable(mutable: Boolean = true): PropertySpec.Builder

True to create a var instead of a val.

receiver

fun receiver(receiverType: TypeName): PropertySpec.Builder
fun receiver(receiverType: Type): PropertySpec.Builder
fun receiver(receiverType: KClass<*>): PropertySpec.Builder

setter

fun setter(setter: FunSpec): PropertySpec.Builder

Inherited Functions

addOriginatingElement

open fun addOriginatingElement(originatingElement: Element): T

Adds an originatingElement to this type's list of originating elements.

tag

open fun tag(type: Class<*>, tag: Any?): T
open fun tag(type: KClass<*>, tag: Any?): T

Attaches tag to the request using type as a key. Tags can be read from a request using Taggable.tag. Use null to remove any existing tag assigned for type.

Extension Functions

jvmDefault

fun PropertySpec.Builder.jvmDefault(): PropertySpec.Builder

jvmField

fun PropertySpec.Builder.jvmField(): PropertySpec.Builder

jvmStatic

fun PropertySpec.Builder.jvmStatic(): PropertySpec.Builder

jvmSuppressWildcards

fun PropertySpec.Builder.jvmSuppressWildcards(suppress: Boolean = true): PropertySpec.Builder

tag

fun <T : Any> PropertySpec.Builder.tag(tag: T?): PropertySpec.Builder

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.

transient

fun PropertySpec.Builder.transient(): PropertySpec.Builder

volatile

fun PropertySpec.Builder.volatile(): PropertySpec.Builder