javapoet-dsl / com.mostlycertain.javapoetdsl / ClassSpecBuilder

ClassSpecBuilder

class ClassSpecBuilder

Constructors

<init>

ClassSpecBuilder(classMeta: ClassMeta, spec: Builder)

Properties

classMeta

val classMeta: ClassMeta

Functions

addClass

fun addClass(classSpec: ClassSpec): Unit

addField

fun addField(fieldSpec: FieldSpec): Unit

addMethod

fun addMethod(methodSpec: MethodSpec): Unit

addType

fun addType(typeSpec: TypeSpec): Unit

classDecl

fun classDecl(name: String, modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), implements: List<TypeName> = emptyList(), extends: TypeName? = null, block: ClassSpecFunc): ClassSpec
fun classDecl(name: ClassName, modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), implements: List<TypeName> = emptyList(), extends: TypeName? = null, block: ClassSpecFunc): ClassSpec

constructorDecl

fun constructorDecl(parameters: List<ParameterSpec> = emptyList(), modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), throws: List<TypeName> = emptyList(), varargs: Boolean = false, body: ConstructorCodeFunc): MethodSpec

fieldDecl

fun fieldDecl(type: TypeName, name: String, modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), initializer: CodeExpression? = null): FieldSpec
fun fieldDecl(type: Type, name: String, modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), initializer: CodeExpression? = null): FieldSpec
fun fieldDecl(type: KClass<*>, name: String, modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), initializer: CodeExpression? = null): FieldSpec

initializerBlockDecl

fun initializerBlockDecl(block: CodeFunc): Unit

methodDecl

fun methodDecl(name: String, parameters: List<ParameterSpec> = emptyList(), modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), throws: List<TypeName> = emptyList(), varargs: Boolean = false, body: MethodCodeFunc? = null): MethodSpec
fun methodDecl(returns: TypeName, name: String, parameters: List<ParameterSpec> = emptyList(), modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), throws: List<TypeName> = emptyList(), varargs: Boolean = false, body: MethodCodeFunc? = null): MethodSpec
fun methodDecl(returns: Type, name: String, parameters: List<ParameterSpec> = emptyList(), modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), throws: List<TypeName> = emptyList(), varargs: Boolean = false, body: MethodCodeFunc? = null): MethodSpec
fun methodDecl(returns: KClass<*>, name: String, parameters: List<ParameterSpec> = emptyList(), modifiers: List<Modifier> = emptyList(), annotations: List<AnnotationSpec> = emptyList(), throws: List<TypeName> = emptyList(), varargs: Boolean = false, body: MethodCodeFunc? = null): MethodSpec

staticInitializerBlockDecl

fun staticInitializerBlockDecl(block: CodeFunc): Unit