Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val tags: MutableMap<KClass<*>, Any>

Mutable map of the current tags this builder contains.

Functions

Link copied to clipboard
fun addAliasedImport(class: <Error class: unknown class><out <Error class: unknown class>>, as: String): FileSpec.Builder
fun addAliasedImport(className: ClassName, memberName: String, as: String): FileSpec.Builder
Link copied to clipboard
@DelicateKotlinPoetApi(message = "Java reflection APIs don't give complete information on Kotlin types. Consider using the kotlinpoet-metadata APIs instead.")
open override fun addAnnotation(annotation: <Error class: unknown class><out <Error class: unknown class>>): FileSpec.Builder
open override fun addAnnotation(annotation: ClassName): FileSpec.Builder
open override fun addAnnotation(annotation: KClass<*>): FileSpec.Builder

open override fun addAnnotation(annotationSpec: AnnotationSpec): FileSpec.Builder

Add an annotation to the file.

Link copied to clipboard
open override fun addAnnotations(annotationSpecs: Iterable<AnnotationSpec>): FileSpec.Builder
Link copied to clipboard
fun addBodyComment(format: String, vararg args: Any): FileSpec.Builder

Adds a comment to the body of this script file in the order that it was added.

Link copied to clipboard
fun addCode(format: String, vararg args: Any?): FileSpec.Builder
Link copied to clipboard

Adds a default import for the given packageName.

Link copied to clipboard
fun addFileComment(format: String, vararg args: Any): FileSpec.Builder

Adds a file-site comment. This is prefixed to the start of the file and different from addBodyComment.

Link copied to clipboard
open override fun addFunction(funSpec: FunSpec): FileSpec.Builder
Link copied to clipboard
Link copied to clipboard
fun addImport(constant: Enum<*>): FileSpec.Builder
fun addImport(class: <Error class: unknown class><out <Error class: unknown class>>, vararg names: String): FileSpec.Builder
fun addImport(class: <Error class: unknown class><out <Error class: unknown class>>, names: Iterable<String>): FileSpec.Builder
fun addImport(className: ClassName, vararg names: String): FileSpec.Builder
fun addImport(packageName: String, vararg names: String): FileSpec.Builder
fun addImport(packageName: String, names: Iterable<String>): FileSpec.Builder
fun addImport(class: KClass<*>, vararg names: String): FileSpec.Builder
Link copied to clipboard
fun addKotlinDefaultImports(includeJvm: Boolean = true, includeJs: Boolean = true): FileSpec.Builder

Adds Kotlin's standard default package imports as described here.

Link copied to clipboard
fun addNamedCode(format: String, args: Map<String, *>): FileSpec.Builder
Link copied to clipboard
Link copied to clipboard
open override fun addProperty(propertySpec: PropertySpec): FileSpec.Builder
@DelicateKotlinPoetApi(message = "Java reflection APIs don't give complete information on Kotlin types. Consider using the kotlinpoet-metadata APIs instead.")
open fun addProperty(name: String, type: <Error class: unknown class>, vararg modifiers: KModifier): FileSpec.Builder
@DelicateKotlinPoetApi(message = "Java reflection APIs don't give complete information on Kotlin types. Consider using the kotlinpoet-metadata APIs instead.")
open fun addProperty(name: String, type: <Error class: unknown class>, modifiers: Iterable<KModifier>): FileSpec.Builder
open fun addProperty(name: String, type: TypeName, vararg modifiers: KModifier): FileSpec.Builder
open fun addProperty(name: String, type: TypeName, modifiers: Iterable<KModifier>): FileSpec.Builder
open fun addProperty(name: String, type: KClass<*>, vararg modifiers: KModifier): FileSpec.Builder
open fun addProperty(name: String, type: KClass<*>, modifiers: Iterable<KModifier>): FileSpec.Builder
Link copied to clipboard
fun addStatement(format: String, vararg args: Any): FileSpec.Builder
Link copied to clipboard
open override fun addType(typeSpec: TypeSpec): FileSpec.Builder
Link copied to clipboard
Link copied to clipboard
open override fun addTypes(typeSpecs: Iterable<TypeSpec>): FileSpec.Builder
Link copied to clipboard
fun beginControlFlow(controlFlow: String, vararg args: Any): FileSpec.Builder
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun nextControlFlow(controlFlow: String, vararg args: Any): FileSpec.Builder
Link copied to clipboard
open fun tag(type: <Error class: unknown class><out <Error class: unknown class>>, tag: Any?): FileSpec.Builder
open fun tag(type: KClass<*>, tag: Any?): FileSpec.Builder

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.

Link copied to clipboard
inline fun <T : Any> FileSpec.Builder.tag(tag: T?): FileSpec.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.