Package com.squareup.javapoet
Class MethodSpec.Builder
java.lang.Object
com.squareup.javapoet.MethodSpec.Builder
- Enclosing class:
MethodSpec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<AnnotationSpec> private final CodeBlock.Builder
private CodeBlock
private final CodeBlock.Builder
private final String
private final List
<ParameterSpec> private TypeName
private List
<TypeVariableName> private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAnnotation
(AnnotationSpec annotationSpec) addAnnotation
(ClassName annotation) addAnnotation
(Class<?> annotation) addAnnotations
(Iterable<AnnotationSpec> annotationSpecs) addException
(TypeName exception) addException
(Type exception) addExceptions
(Iterable<? extends TypeName> exceptions) addJavadoc
(String format, Object... args) addModifiers
(Iterable<Modifier> modifiers) addModifiers
(Modifier... modifiers) addParameter
(ParameterSpec parameterSpec) addParameter
(TypeName type, String name, Modifier... modifiers) addParameter
(Type type, String name, Modifier... modifiers) addParameters
(Iterable<ParameterSpec> parameterSpecs) addStatement
(String format, Object... args) addTypeVariable
(TypeVariableName typeVariable) addTypeVariables
(Iterable<TypeVariableName> typeVariables) beginControlFlow
(String controlFlow, Object... args) build()
defaultValue
(CodeBlock codeBlock) defaultValue
(String format, Object... args) endControlFlow
(String controlFlow, Object... args) nextControlFlow
(String controlFlow, Object... args) varargs()
varargs
(boolean varargs)
-
Field Details
-
name
-
javadoc
-
annotations
-
modifiers
-
typeVariables
-
returnType
-
parameters
-
exceptions
-
code
-
varargs
private boolean varargs -
defaultValue
-
-
Constructor Details
-
Builder
-
-
Method Details
-
addJavadoc
-
addAnnotations
-
addAnnotation
-
addAnnotation
-
addAnnotation
-
addModifiers
-
addModifiers
-
addTypeVariables
-
addTypeVariable
-
returns
-
returns
-
addParameters
-
addParameter
-
addParameter
-
addParameter
-
varargs
-
varargs
-
addExceptions
-
addException
-
addException
-
addCode
-
addCode
-
defaultValue
-
defaultValue
-
beginControlFlow
- Parameters:
controlFlow
- 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.
-
endControlFlow
-
endControlFlow
- Parameters:
controlFlow
- the optional control flow construct and its code, such as "while(foo == 20)". Only used for "do/while" control flows.
-
addStatement
-
build
-