ClassHeaderBuilder¶
class ClassHeaderBuilder
A fluent builder for a class header string, assembled in a fixed order: modifiers, name, type parameters, base class, and type constraints. Call asString to obtain the resulting header text, then pass it to createClass to build the PSI.
Calls are expected in that order. Order violations are checked only when JVM assertions are enabled.
Constructors¶
ClassHeaderBuilder¶
constructor()
Types¶
State¶
enum class State : Enum<KtPsiFactory.ClassHeaderBuilder.State>
The stages in the expected order for building a class header.
Functions¶
asString¶
baseClass¶
fun baseClass(
@NonNls name: String,
typeArguments: Collection<String>,
isInterface: Boolean
): KtPsiFactory.ClassHeaderBuilder
Appends the base class or interface: its name and typeArguments. When isInterface is false, an empty constructor call () is appended.
modifier¶
fun modifier(@NonNls modifier: String): KtPsiFactory.ClassHeaderBuilder
name¶
fun name(@NonNls name: String): KtPsiFactory.ClassHeaderBuilder
Appends the class keyword and the class name. Ends the modifiers stage.
transform¶
fun transform(f: StringBuilder.() -> Unit)
Applies an arbitrary transformation to the underlying text buffer.
typeConstraints¶
fun typeConstraints(values: Collection<String>): KtPsiFactory.ClassHeaderBuilder
Appends the where clause type constraints, if any.
typeParameters¶
fun typeParameters(values: Collection<String>): KtPsiFactory.ClassHeaderBuilder
Appends the type parameters, if any.