Class TypeSpec.Builder
java.lang.Object
com.squareup.javapoet.TypeSpec.Builder
- Enclosing class:
TypeSpec
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<AnnotationSpec> final List<MethodSpec> final List<TypeVariableName> -
Method Summary
Modifier and TypeMethodDescriptionaddAnnotation(AnnotationSpec annotationSpec) addAnnotation(ClassName annotation) addAnnotation(Class<?> annotation) addAnnotations(Iterable<AnnotationSpec> annotationSpecs) addEnumConstant(String name) addEnumConstant(String name, TypeSpec typeSpec) addInitializerBlock(CodeBlock block) addJavadoc(CodeBlock block) addJavadoc(String format, Object... args) addMethod(MethodSpec methodSpec) addMethods(Iterable<MethodSpec> methodSpecs) addModifiers(Modifier... modifiers) addOriginatingElement(Element originatingElement) addStaticBlock(CodeBlock block) addSuperinterface(TypeName superinterface) addSuperinterface(Type superinterface) addSuperinterface(Type superinterface, boolean avoidNestedTypeNameClashes) addSuperinterface(TypeMirror superinterface) addSuperinterface(TypeMirror superinterface, boolean avoidNestedTypeNameClashes) addSuperinterfaces(Iterable<? extends TypeName> superinterfaces) addTypeVariable(TypeVariableName typeVariable) addTypeVariables(Iterable<TypeVariableName> typeVariables) alwaysQualify(String... simpleNames) avoidClashesWithNestedClasses(Class<?> clazz) Call this to always fully qualify any types that would conflict with possibly nested types of thistypeElement.avoidClashesWithNestedClasses(TypeElement typeElement) Call this to always fully qualify any types that would conflict with possibly nested types of thistypeElement.build()superclass(TypeName superclass) superclass(Type superclass) superclass(Type superclass, boolean avoidNestedTypeNameClashes) superclass(TypeMirror superclass) superclass(TypeMirror superclass, boolean avoidNestedTypeNameClashes)
-
Field Details
-
enumConstants
-
annotations
-
modifiers
-
typeVariables
-
superinterfaces
-
fieldSpecs
-
methodSpecs
-
typeSpecs
-
originatingElements
-
alwaysQualifiedNames
-
-
Method Details
-
addJavadoc
-
addJavadoc
-
addAnnotations
-
addAnnotation
-
addAnnotation
-
addAnnotation
-
addModifiers
-
addTypeVariables
-
addTypeVariable
-
superclass
-
superclass
-
superclass
-
superclass
-
superclass
-
addSuperinterfaces
-
addSuperinterface
-
addSuperinterface
-
addSuperinterface
-
addSuperinterface
-
addSuperinterface
public TypeSpec.Builder addSuperinterface(TypeMirror superinterface, boolean avoidNestedTypeNameClashes) -
addEnumConstant
-
addEnumConstant
-
addFields
-
addField
-
addField
-
addField
-
addStaticBlock
-
addInitializerBlock
-
addMethods
-
addMethod
-
addTypes
-
addType
-
addOriginatingElement
-
alwaysQualify
-
avoidClashesWithNestedClasses
Call this to always fully qualify any types that would conflict with possibly nested types of thistypeElement. For example - if the following type was passed in as the typeElement:class Foo { class NestedTypeA { } class NestedTypeB { } }Then this would add
"NestedTypeA"and"NestedTypeB"as names that should always be qualified viaalwaysQualify(String...). This way they would avoid possible import conflicts when this JavaFile is written.- Parameters:
typeElement- theTypeElementwith nested types to avoid clashes with.- Returns:
- this builder instance.
-
avoidClashesWithNestedClasses
Call this to always fully qualify any types that would conflict with possibly nested types of thistypeElement. For example - if the following type was passed in as the typeElement:class Foo { class NestedTypeA { } class NestedTypeB { } }Then this would add
"NestedTypeA"and"NestedTypeB"as names that should always be qualified viaalwaysQualify(String...). This way they would avoid possible import conflicts when this JavaFile is written.- Parameters:
clazz- theClasswith nested types to avoid clashes with.- Returns:
- this builder instance.
-
build
-