Package io.micronaut.sourcegen.javapoet
Class MethodSpec.Builder
java.lang.Object
io.micronaut.sourcegen.javapoet.MethodSpec.Builder
- Enclosing class:
- MethodSpec
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<AnnotationSpec>
final List<ParameterSpec>
final List<TypeVariableName>
-
Method Summary
Modifier and TypeMethodDescriptionaddAnnotation
(AnnotationSpec annotationSpec) addAnnotation
(ClassName annotation) addAnnotation
(Class<?> annotation) addAnnotations
(Iterable<AnnotationSpec> annotationSpecs) addComment
(String format, Object... args) addException
(TypeName exception) addException
(Type exception) addExceptions
(Iterable<? extends TypeName> exceptions) addJavadoc
(CodeBlock block) addJavadoc
(String format, Object... args) addModifiers
(Iterable<Modifier> modifiers) addModifiers
(Modifier... modifiers) addNamedCode
(String format, Map<String, ?> args) addParameter
(ParameterSpec parameterSpec) addParameter
(TypeName type, String name, Modifier... modifiers) addParameter
(Type type, String name, Modifier... modifiers) addParameters
(Iterable<ParameterSpec> parameterSpecs) addStatement
(CodeBlock codeBlock) addStatement
(String format, Object... args) addTypeVariable
(TypeVariableName typeVariable) addTypeVariables
(Iterable<TypeVariableName> typeVariables) beginControlFlow
(CodeBlock codeBlock) beginControlFlow
(String controlFlow, Object... args) build()
defaultAnnotationValue
(AnnotationSpec annotationSpec) Set the default method value that is an annotation.defaultValue
(CodeBlock codeBlock) defaultValue
(String format, Object... args) endControlFlow
(CodeBlock codeBlock) endControlFlow
(String controlFlow, Object... args) nextControlFlow
(CodeBlock codeBlock) nextControlFlow
(String controlFlow, Object... args) varargs()
varargs
(boolean varargs)
-
Field Details
-
typeVariables
-
annotations
-
modifiers
-
parameters
-
-
Method Details
-
setName
-
addJavadoc
-
addJavadoc
-
addAnnotations
-
addAnnotation
-
addAnnotation
-
addAnnotation
-
addModifiers
-
addModifiers
-
addTypeVariables
-
addTypeVariable
-
returns
-
returns
-
addParameters
-
addParameter
-
addParameter
-
addParameter
-
varargs
-
varargs
-
addExceptions
-
addException
-
addException
-
addCode
-
addNamedCode
-
addCode
-
addComment
-
defaultValue
-
defaultValue
-
defaultAnnotationValue
Set the default method value that is an annotation. Used for defining defaults of annotation object members.- Parameters:
annotationSpec
- The default annotation- Returns:
- This builder
-
beginControlFlow
- Parameters:
controlFlow
- the control flow construct and its code, such as "if (foo == 5)". Shouldn't contain braces or newline characters.
-
beginControlFlow
- Parameters:
codeBlock
- the control flow construct and its code, such as "if (foo == 5)". Shouldn't contain braces or newline characters.
-
nextControlFlow
- Parameters:
controlFlow
- the control flow construct and its code, such as "else if (foo == 10)". Shouldn't contain braces or newline characters.
-
nextControlFlow
- Parameters:
codeBlock
- the control flow construct and its code, such as "else if (foo == 10)". Shouldn't contain braces or newline characters.
-
endControlFlow
-
endControlFlow
- Parameters:
controlFlow
- the optional control flow construct and its code, such as "while(foo == 20)". Only used for "do/while" control flows.
-
endControlFlow
- Parameters:
codeBlock
- the optional control flow construct and its code, such as "while(foo == 20)". Only used for "do/while" control flows.
-
addStatement
-
addStatement
-
build
-