Class ClassModel.Builder
java.lang.Object
io.helidon.codegen.classmodel.ClassBase.Builder<ClassModel.Builder, ClassModel>
io.helidon.codegen.classmodel.ClassModel.Builder
- All Implemented Interfaces:
Builder<ClassModel.Builder, ClassModel>, Supplier<ClassModel>
- Enclosing class:
ClassModel
public static final class ClassModel.Builder
extends ClassBase.Builder<ClassModel.Builder, ClassModel>
Fluent API builder for
ClassModel.-
Method Summary
Modifier and TypeMethodDescriptionaccessModifier(AccessModifier accessModifier) addAnnotation(Annotation annotation) Add new annotation to the component.addAnnotation(Annotation.Builder builder) Add new annotation to the component.addAnnotation(Annotation annotation) Add new annotation to the component.addAnnotation(Consumer<Annotation.Builder> consumer) Add new annotation to the component.addDescriptionLine(String line) build()Build the instance from this builder.Copyright header to be used.description(String description) description(List<String> description) Find if the provided type name is handled as part of this generated class.includeImport(boolean includeImport) Whether to include import type information among the imports.packageName(String packageName) Package name of this type.staticInitializer(Consumer<ContentBuilder<?>> contentBuilder) Update the static initializer of this class.Methods inherited from class ClassBase.Builder
addConstructor, addConstructor, addEnumConstant, addField, addField, addField, addGenericArgument, addGenericArgument, addImport, addImport, addImport, addInnerClass, addInnerClass, addInnerClass, addInterface, addInterface, addInterface, addJavadocTag, addMethod, addMethod, addMethod, addPermittedSubclass, addPermittedSubclass, addPermittedSubclass, addStaticImport, classType, isAbstract, isFinal, javadoc, sealed, sortFields, sortStaticFields, superType, superType, superTypeModifier and TypeMethodDescriptionaddConstructor(Constructor.Builder constructor) Add new constructor to this class.addConstructor(Consumer<Constructor.Builder> consumer) Add new constructor to this class.addEnumConstant(Consumer<EnumConstant.Builder> builderConsumer) Add an enum constant (only valid if the class type is set to ENUM.Add new field to the type.addField(Field.Builder builder) Add new field to the type.addField(Consumer<Field.Builder> consumer) Add new field to the type.addGenericArgument(TypeArgument typeArgument) Add generic argument type.addGenericArgument(Consumer<TypeArgument.Builder> consumer) Add generic argument type.Add specific fully qualified type name to be imported.Add specific class to be imported.Add specific fully qualified type name to be imported.addInnerClass(InnerClass innerClass) Add new inner type to this type.addInnerClass(Consumer<InnerClass.Builder> consumer) Add new inner type to this type.addInnerClass(Supplier<InnerClass> supplier) Add new inner type to this type.addInterface(TypeName interfaceType) Add interface this type should implement.addInterface(Class<?> interfaceType) Add interface this type should implement.addInterface(String interfaceName) Add interface this type should implement.addJavadocTag(String tag, String description) Add new method to the type.addMethod(Method.Builder builder) Add new method to the type.addMethod(Consumer<Method.Builder> consumer) Add new method to the type.addPermittedSubclass(TypeName permittedSubclass) Add a permitted direct subclass of this sealed type.addPermittedSubclass(Class<?> permittedSubclass) Add a permitted direct subclass of this sealed type.addPermittedSubclass(String permittedSubclass) Add a permitted direct subclass of this sealed type.addStaticImport(String staticImport) Add specific static import.classType(ElementKind kind) Type of the Java type we are creating.isAbstract(boolean isAbstract) Whether this type is abstract.isFinal(boolean isFinal) Whether this type is final.sealed(boolean sealed) Whether this type is sealed.sortFields(boolean sort) Whether to sort non-static fields by type and name (defaults totrue).sortStaticFields(boolean sort) Whether to sort static fields by type and name (defaults totrue).Set new super type of this type.Set new super type of this type.Set new fully qualified super type name of this type.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Builder
get, identity, updateModifier and TypeMethodDescriptiondefault ClassModelget()default ClassModel.Builderidentity()Instance of this builder as the correct type.default ClassModel.Builderupdate(Consumer<ClassModel.Builder> consumer) Update the builder in a fluent API way.
-
Method Details
-
build
Description copied from interface:BuilderBuild the instance from this builder.- Returns:
- instance of the built type
-
accessModifier
- Overrides:
accessModifierin classClassBase.Builder<ClassModel.Builder, ClassModel>
-
packageName
Package name of this type.- Parameters:
packageName- type package name- Returns:
- updated builder instance
-
copyright
Copyright header to be used.- Parameters:
copyright- copyright header- Returns:
- updated builder instance
-
name
-
type
-
staticInitializer
Update the static initializer of this class.- Parameters:
contentBuilder- content builder consumer to update the static initializer- Returns:
- updated builder instance
-
find
-
description
-
description
-
addDescriptionLine
-
addAnnotation
Add new annotation to the component.- Parameters:
annotation- annotation instance- Returns:
- updated builder instance
-
addAnnotation
Add new annotation to the component.- Parameters:
consumer- annotation builder consumer- Returns:
- updated builder instance
-
addAnnotation
Add new annotation to the component.- Parameters:
builder- annotation builder- Returns:
- updated builder instance
-
addAnnotation
Add new annotation to the component.- Parameters:
annotation- annotation instance- Returns:
- updated builder instance
-
includeImport
Whether to include import type information among the imports.- Parameters:
includeImport- whether imports should be included- Returns:
- updated builder instance
-