kotlinpoet / com.squareup.kotlinpoet / FileSpec

FileSpec

class FileSpec

A Kotlin file containing top level objects like classes, objects, functions, properties, and type aliases.

Items are output in the following order:

Types

Builder

class Builder

Properties

annotations

val annotations: List<AnnotationSpec>

comment

val comment: CodeBlock

members

val members: List<Any>

name

val name: String

packageName

val packageName: String

Functions

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

toBuilder

fun toBuilder(): Builder

toJavaFileObject

fun toJavaFileObject(): JavaFileObject

toString

fun toString(): String

writeTo

fun writeTo(out: Appendable): Unitfun writeTo(directory: Path): Unit
fun writeTo(directory: File): Unit

Writes this to directory as UTF-8 using the standard directory structure.

Companion Object Functions

builder

fun builder(packageName: String, fileName: String): Builder

get

fun get(packageName: String, typeSpec: TypeSpec): FileSpec