Package io.micronaut.sourcegen.javapoet
Class TypeSpec.Builder
java.lang.Object
io.micronaut.sourcegen.javapoet.TypeSpec.Builder
- Enclosing class:
- TypeSpec
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<AnnotationSpec>final List<MethodSpec>final List<ParameterSpec>final List<TypeVariableName>boolean -
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 value) addJavadoc(String format, Object... args) addMethod(MethodSpec methodSpec) addMethods(Iterable<MethodSpec> methodSpecs) addModifiers(Modifier... modifiers) addOriginatingElement(Element originatingElement) addPermittedSubclass(TypeName subclass) addPermittedSubclasses(Iterable<? extends TypeName> subclasses) addRecordComponent(ParameterSpec parameterSpec) addRecordComponents(Iterable<ParameterSpec> parameterSpecs) 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()compactConstructor(MethodSpec methodSpec) Sets the compact constructor for this builder.superclass(TypeName superclass) superclass(Type superclass) superclass(Type superclass, boolean avoidNestedTypeNameClashes) superclass(TypeMirror superclass) superclass(TypeMirror superclass, boolean avoidNestedTypeNameClashes) varargs()varargs(boolean varargs)
-
Field Details
-
enumConstants
-
recordComponents
-
varargs
public boolean varargs -
permittedSubclasses
-
annotations
-
modifiers
-
typeVariables
-
superinterfaces
-
fieldSpecs
-
methodSpecs
-
typeSpecs
-
originatingElements
-
alwaysQualifiedNames
-
-
Method Details
-
addJavadoc
-
addJavadoc
-
addJavadoc
-
addAnnotations
-
addAnnotation
-
addAnnotation
-
addAnnotation
-
addModifiers
-
addTypeVariables
-
addTypeVariable
-
superclass
-
superclass
-
superclass
-
superclass
-
superclass
-
addSuperinterfaces
-
addSuperinterface
-
addSuperinterface
-
addSuperinterface
-
addPermittedSubclasses
-
addPermittedSubclass
-
addSuperinterface
-
addSuperinterface
public TypeSpec.Builder addSuperinterface(TypeMirror superinterface, boolean avoidNestedTypeNameClashes) -
addRecordComponents
-
addRecordComponent
-
varargs
-
varargs
-
compactConstructor
Sets the compact constructor for this builder. Its parameters are solely used for javadoc generation. -
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
-