Class MethodDef.MethodDefBuilder
java.lang.Object
io.micronaut.sourcegen.model.AbstractElementBuilder<MethodDef.MethodDefBuilder>
io.micronaut.sourcegen.model.MethodDef.MethodDefBuilder
- Enclosing class:
MethodDef
public static final class MethodDef.MethodDefBuilder
extends AbstractElementBuilder<MethodDef.MethodDefBuilder>
The method builder definition.
- Since:
- 1.0
- Author:
- Denis Stepanov
-
Field Summary
Fields inherited from class AbstractElementBuilder
annotations, javadoc, modifiers, name, synthetic, thisInstance -
Method Summary
Modifier and TypeMethodDescriptionaddParameter(ParameterDef parameterDef) Add a parameter.addParameter(TypeDef type) Add a parameter.addParameter(Class<?> type) Add a parameter.addParameter(String name, TypeDef type) Add a parameter.addParameter(String name, Class<?> type) Add a parameter.addParameters(TypeDef... types) Add parameters.addParameters(Class<?>... types) Add a parameters.addParameters(Collection<ParameterDef> parameters) Add parameters.addParameters(List<TypeDef> types) Add parameters.addStatement(MethodDef.MethodBodyBuilder bodyBuilder) Add a statement to the method body.addStatement(StatementDef statement) Add a statement to the method body.addStatements(Collection<StatementDef> newStatements) Add statements to the method body.addStaticStatement(Function<List<VariableDef.MethodParameter>, StatementDef> bodyBuilder) Add a statement to the static method body.Add throw expressions to the method.Add throw expressions to the method.addTypeVariable(TypeDef.TypeVariable typeVariable) Add a type variable.addTypeVariables(List<TypeDef.TypeVariable> typeVariables) Add a type variable.build()build(MethodDef.MethodBodyBuilder bodyBuilder) Build a method with a body builder.buildStatic(Function<List<VariableDef.MethodParameter>, StatementDef> bodyBuilder) Build a static method with a body builder.Mark the method as an override.overrides(boolean overrides) Mark the method as an override.The return type of the method.Methods inherited from class AbstractElementBuilder
addAnnotation, addAnnotation, addAnnotation, addAnnotation, addAnnotations, addAnnotations, addJavadoc, addJavadoc, addModifiers, addModifiers, overrideModifiers, synthetic, synthetic
-
Method Details
-
addTypeVariable
Add a type variable.- Parameters:
typeVariable- The type variable- Returns:
- The type variable
-
addTypeVariables
Add a type variable.- Parameters:
typeVariables- The type variables- Returns:
- The type variable
-
returns
The return type of the method. In a case of missing return type it will be extracted from the statements.- Parameters:
type- The return type- Returns:
- the current builder
-
overrides
Mark the method as an override.- Returns:
- the current builder
-
overrides
Mark the method as an override.- Parameters:
overrides- The value- Returns:
- the current builder
-
returns
-
addParameter
Add a parameter.- Parameters:
name- The nametype- The type- Returns:
- a builder
- Since:
- 1.5
-
addParameter
Add a parameter.- Parameters:
type- The type- Returns:
- a builder
- Since:
- 1.5
-
addParameter
Add a parameter.- Parameters:
parameterDef- The parameter def- Returns:
- a builder
- Since:
- 1.5
-
addParameters
Add parameters.- Parameters:
parameters- The parameters- Returns:
- a builder
- Since:
- 1.5
-
addParameter
Add a parameter.- Parameters:
name- The nametype- The type- Returns:
- a builder
-
addParameter
Add a parameter.- Parameters:
type- The type- Returns:
- a builder
- Since:
- 1.5
-
addParameters
Add a parameters.- Parameters:
types- The types- Returns:
- a builder
- Since:
- 1.5
-
addParameters
Add parameters.- Parameters:
types- The types- Returns:
- a builder
- Since:
- 1.5
-
addParameters
Add parameters.- Parameters:
types- The types- Returns:
- a builder
- Since:
- 1.5
-
addStaticStatement
public MethodDef.MethodDefBuilder addStaticStatement(Function<List<VariableDef.MethodParameter>, StatementDef> bodyBuilder) Add a statement to the static method body.- Parameters:
bodyBuilder- The builder- Returns:
- The builder
- Since:
- 1.5
-
addStatement
Add a statement to the method body.- Parameters:
statement- The statement- Returns:
- The builder
-
addStatement
Add a statement to the method body.- Parameters:
bodyBuilder- The body builder- Returns:
- The builder
-
addStatements
Add statements to the method body.- Parameters:
newStatements- The new statements- Returns:
- The builder
-
addThrows
Add throw expressions to the method.- Parameters:
types- The types that this method throws- Returns:
- The builder
-
addThrows
Add throw expressions to the method.- Parameters:
types- The types that this method throws- Returns:
- The builder
-
build
-
build
Build a method with a body builder.- Parameters:
bodyBuilder- The body builder- Returns:
- The builder
-
buildStatic
Build a static method with a body builder.- Parameters:
bodyBuilder- The body builder- Returns:
- The builder
-