Class Field.Builder
java.lang.Object
io.helidon.codegen.classmodel.Field.Builder
- All Implemented Interfaces:
ContentBuilder<Field.Builder>, Builder<Field.Builder, Field>, Supplier<Field>
- Enclosing class:
Field
Fluent API builder for
Field.-
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.addContent(TypeName typeName) Add type name to content, correctly handling imports.addContent(String line) Add text line to the content.addDescriptionLine(String line) addTypeToContent(String typeName) Obtained fully qualified type name is enclosed betweenClassModel.TYPE_TOKENtokens.build()Build the instance from this builder.Clears created content.Set new content.Method for manual padding decrement.defaultValue(String defaultValue) Set default value this field should be initialized with, wrapping the value in double quotes if the field type is String.defaultValueContent(String defaultValue) Configure a default value for this field as a string that will be copied verbatim to the generated sources.description(String description) description(List<String> description) includeImport(boolean includeImport) Whether to include import type information among the imports.Method for manual padding increment.isFinal(boolean isFinal) Whether this field is final.isStatic(boolean isStatic) Whether this field is static.isVolatile(boolean isVolatile) Whether this field isvolatile.Adds single padding.padContent(int repetition) Adds padding with number of repetitions.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 Fieldget()default Field.Builderidentity()Instance of this builder as the correct type.default Field.Builderupdate(Consumer<Field.Builder> consumer) Update the builder in a fluent API way.Methods inherited from interface ContentBuilder
addContent, addContentCreate, addContentCreate, addContentCreate, addContentCreate, addContentLine, addContentLine, addContentLiteral, contentModifier and TypeMethodDescriptiondefault Field.BuilderaddContent(Class<?> type) Obtained type is enclosed betweenClassModel.TYPE_TOKENtokens.default Field.BuilderaddContentCreate(Annotation annotation) Add content that creates a newAnnotationin the generated code that is the same as the annotation provided.default Field.BuilderaddContentCreate(ResolvedType type) Add content that creates a newResolvedTypein the generated code that is the same as the type name provided.default Field.BuilderaddContentCreate(TypedElementInfo element) Add content that creates a newTypedElementInfoin the generated code that is the same as the element provided.default Field.BuilderaddContentCreate(TypeName typeName) Add content that creates a newTypeNamein the generated code that is the same as the type name provided.default Field.BuilderAdd a new line (empty).default Field.BuilderaddContentLine(String line) Add text line to the content.default Field.BuilderaddContentLiteral(String literal) Adds the provided literal as content, enclosed in double quotes.default Field.BuilderSet new content.
-
Method Details
-
build
-
defaultValue
Set default value this field should be initialized with, wrapping the value in double quotes if the field type is String.- Parameters:
defaultValue- default value- Returns:
- updated builder instance
-
defaultValueContent
Configure a default value for this field as a string that will be copied verbatim to the generated sources.- Parameters:
defaultValue- default value- Returns:
- updated builder instance
-
content
Description copied from interface:ContentBuilderSet new content. This method replaces previously created content in this builder.- Specified by:
contentin interfaceContentBuilder<Field.Builder>- Parameters:
content- content to be set- Returns:
- updated builder instance
-
addContent
Description copied from interface:ContentBuilderAdd text line to the content. New line character is not added after this line, so all newly added text will be appended to the same line.- Specified by:
addContentin interfaceContentBuilder<Field.Builder>- Parameters:
line- line to add- Returns:
- updated builder instance
-
addContent
Description copied from interface:ContentBuilderAdd type name to content, correctly handling imports. In case the type should not contain any type parameters, useTypeName.genericTypeName().- Specified by:
addContentin interfaceContentBuilder<Field.Builder>- Parameters:
typeName- type name to add- Returns:
- updated component builder
-
padContent
Description copied from interface:ContentBuilderAdds single padding. This extra padding is added only once. If more permanent padding increment is needed use {ContentBuilder.increaseContentPadding()}.- Specified by:
padContentin interfaceContentBuilder<Field.Builder>- Returns:
- updated builder instance
-
padContent
Description copied from interface:ContentBuilderAdds padding with number of repetitions. This extra padding is added only once. If more permanent padding increment is needed use {ContentBuilder.increaseContentPadding()}.- Specified by:
padContentin interfaceContentBuilder<Field.Builder>- Parameters:
repetition- number of padding repetitions- Returns:
- updated builder instance
-
increaseContentPadding
Description copied from interface:ContentBuilderMethod for manual padding increment. This method will affect padding of the later added content.- Specified by:
increaseContentPaddingin interfaceContentBuilder<Field.Builder>- Returns:
- updated builder instance
-
decreaseContentPadding
Description copied from interface:ContentBuilderMethod for manual padding decrement. This method will affect padding of the later added content.- Specified by:
decreaseContentPaddingin interfaceContentBuilder<Field.Builder>- Returns:
- updated builder instance
-
clearContent
Description copied from interface:ContentBuilderClears created content.- Specified by:
clearContentin interfaceContentBuilder<Field.Builder>- Returns:
- updated builder instance
-
addTypeToContent
Description copied from interface:ContentBuilderObtained fully qualified type name is enclosed betweenClassModel.TYPE_TOKENtokens. Class names in such a format are later recognized as class names for import handling.- Specified by:
addTypeToContentin interfaceContentBuilder<Field.Builder>- Parameters:
typeName- fully qualified class name to import- Returns:
- updated builder instance
-
isFinal
Whether this field is final.- Parameters:
isFinal- final field- Returns:
- updated builder instance
-
isVolatile
Whether this field isvolatile.- Parameters:
isVolatile- volatile field- Returns:
- updated builder instance
-
isStatic
Whether this field is static.- Parameters:
isStatic- static field- Returns:
- updated builder instance
-
type
-
type
-
type
-
accessModifier
-
javadoc
-
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
-
name
-
includeImport
Whether to include import type information among the imports.- Parameters:
includeImport- whether imports should be included- Returns:
- updated builder instance
-