Class Method.Builder
java.lang.Object
io.helidon.codegen.classmodel.Executable.Builder<Method.Builder, Method>
io.helidon.codegen.classmodel.Method.Builder
- All Implemented Interfaces:
ContentBuilder<Method.Builder>, Builder<Method.Builder, Method>, Supplier<Method>
- Enclosing class:
Method
Fluent API builder for
Method.-
Method Summary
Modifier and TypeMethodDescriptionaddAnnotation(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) addGenericArgument(TypeArgument typeArgument) Add generic argument to be declared by this method.build()Build the instance from this builder.Set new content.description(String description) description(List<String> description) from(TypedElementInfo methodInfo) Create all method metadata from the provided method information.includeImport(boolean includeImport) Whether to include import type information among the imports.isAbstract(boolean isAbstract) Whether this method is abstract.isDefault(boolean isDefault) Whether this method is default.isFinal(boolean isFinal) Whether this method is final.isStatic(boolean isStatic) Whether this method is static.returnType(Returns returnType) Set return type of the method.returnType(TypeName type) Set return type of the method.returnType(TypeName type, String description) Set return type of the method.returnType(Consumer<Returns.Builder> consumer) Set return type of the method.returnType(Supplier<Returns> supplier) Set return type of the method.Methods inherited from class Executable.Builder
accessModifier, addContent, addContent, addJavadocTag, addParameter, addParameter, addParameter, addParameter, addThrows, addThrows, addThrows, addThrows, addThrows, addTypeToContent, clearContent, decreaseContentPadding, generateJavadoc, increaseContentPadding, javadoc, padContent, padContentModifier and TypeMethodDescriptionaccessModifier(AccessModifier accessModifier) addContent(TypeName typeName) Add type name to content, correctly handling imports.addContent(String line) Add text line to the content.addJavadocTag(String tag, String description) addParameter(Parameter parameter) Add new method parameter.addParameter(TypeName type, String name) Add a new method parameter.addParameter(Consumer<Parameter.Builder> consumer) Add new method parameter.addParameter(Supplier<Parameter> supplier) Add new method parameter.Add a declared throws definition.Add a declared throws definition.Add a declared throws definition.addThrows(Consumer<Throws.Builder> consumer) Add a declared throws definition.Add a declared throws definition.addTypeToContent(String typeName) Obtained fully qualified type name is enclosed betweenClassModel.TYPE_TOKENtokens.Clears created content.Method for manual padding decrement.generateJavadoc(boolean generateJavadoc) Method for manual padding increment.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 Methodget()default Method.Builderidentity()Instance of this builder as the correct type.default Method.Builderupdate(Consumer<Method.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 Method.BuilderaddContent(Class<?> type) Obtained type is enclosed betweenClassModel.TYPE_TOKENtokens.default Method.BuilderaddContentCreate(Annotation annotation) Add content that creates a newAnnotationin the generated code that is the same as the annotation provided.default Method.BuilderaddContentCreate(ResolvedType type) Add content that creates a newResolvedTypein the generated code that is the same as the type name provided.default Method.BuilderaddContentCreate(TypedElementInfo element) Add content that creates a newTypedElementInfoin the generated code that is the same as the element provided.default Method.BuilderaddContentCreate(TypeName typeName) Add content that creates a newTypeNamein the generated code that is the same as the type name provided.default Method.BuilderAdd a new line (empty).default Method.BuilderaddContentLine(String line) Add text line to the content.default Method.BuilderaddContentLiteral(String literal) Adds the provided literal as content, enclosed in double quotes.default Method.BuilderSet new content.
-
Method Details
-
build
-
content
Description copied from interface:ContentBuilderSet new content. This method replaces previously created content in this builder.- Specified by:
contentin interfaceContentBuilder<Method.Builder>- Overrides:
contentin classExecutable.Builder<Method.Builder, Method>- Parameters:
content- content to be set- Returns:
- updated builder instance
-
isFinal
Whether this method is final.- Parameters:
isFinal- method is final- Returns:
- updated builder instance
-
isStatic
Whether this method is static.- Parameters:
isStatic- method is static- Returns:
- updated builder instance
-
isAbstract
Whether this method is abstract.- Parameters:
isAbstract- method is abstract- Returns:
- updated builder instance
-
isDefault
Whether this method is default.- Parameters:
isDefault- method is default- Returns:
- updated builder instance
-
returnType
Set return type of the method. Default isvoid.- Parameters:
type- return type- Returns:
- updated builder instance
-
returnType
Set return type of the method. Default isvoid.- Parameters:
type- return typedescription- return type description- Returns:
- updated builder instance
-
returnType
Set return type of the method. Default isvoid.- Parameters:
consumer- return type builder consumer- Returns:
- updated builder instance
-
returnType
Set return type of the method. Default isvoid.- Parameters:
supplier- return type supplier- Returns:
- updated builder instance
-
returnType
Set return type of the method. Default isvoid.- Parameters:
returnType- return type- Returns:
- updated builder instance
-
addGenericArgument
Add generic argument to be declared by this method.- Parameters:
typeArgument- argument to be declared- Returns:
- updated builder instance
-
from
Create all method metadata from the provided method information. This will populate annotations, return type, method name etc., except for the body and javadoc.- Parameters:
methodInfo- method element information- Returns:
- updated builder
-
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
-