addFieldWithInitializer

open fun addFieldWithInitializer(typeClass: Class<out Any>, name: String, initializer: Expression, modifiers: Array<Modifier.DefaultKeyword>): FieldDeclaration(source)

Add a field to this and automatically add the import of the type if needed

Return

the FieldDeclaration created

Parameters

typeClass

the type of the field

name

the name of the field

initializer

the initializer of the field

modifiers

the modifiers like PUBLIC


open fun addFieldWithInitializer(type: Type, name: String, initializer: Expression, modifiers: Array<Modifier.Keyword>): FieldDeclaration(source)

Add a field to this.

Return

the FieldDeclaration created

Parameters

type

the type of the field

name

the name of the field

initializer

the initializer of the field

modifiers

the modifiers like PUBLIC