Class TypeClass
java.lang.Object
org.inferred.freebuilder.processor.source.ValueType
org.inferred.freebuilder.processor.source.Type
org.inferred.freebuilder.processor.source.TypeClass
- All Implemented Interfaces:
Excerpt
Representation of a class or interface element.
When used as an excerpt or Type, it acts as a prototypical type of the class.
This is the element's invocation on the type variables corresponding to its own formal type
parameters. For example, the TypeClass of EnumSet would appear in code as
EnumSet<E>. This is probably the most common use of a type class in code generation.
The declaration() and declarationParameters() methods, on the other hand,
return excerpts reflecting the type element. For example, the declaration of EnumSet
would be EnumSet<E extends Enum<E>>.
A hybrid of a TypeElement and its prototypical DeclaredType.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Type
Type.JavadocLink, Type.TypeImplNested classes/interfaces inherited from class ValueType
ValueType.FieldReceiver -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final QualifiedNameprivate final List<TypeParameterElement> -
Constructor Summary
ConstructorsConstructorDescriptionTypeClass(QualifiedName qualifiedName, Collection<? extends TypeParameterElement> typeParameters) -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddDeclarationParameters(SourceBuilder source, List<TypeParameterElement> typeParameters) protected voidaddFields(ValueType.FieldReceiver fields) Implement this method to report the name and value of each field.Returns a source excerpt suitable for declaring this type element.Returns a source excerpt of the type parameters of this type element, including bounds and angle brackets.private static booleanextendsObject(TypeParameterElement element) static TypeClassfrom(TypeElement typeElement) static TypeClassfromNonGeneric(Class<?> cls) Returns the qualified name of the type class.protected List<TypeParameterElement> toString()Methods inherited from class Type
addTo, constructor, diamondOperator, from, from, getSimpleName, isParameterized, javadocLink, javadocMethodLink, javadocNoArgMethodLink, typeParameters, withWildcards
-
Field Details
-
qualifiedName
-
typeParameters
-
-
Constructor Details
-
TypeClass
TypeClass(QualifiedName qualifiedName, Collection<? extends TypeParameterElement> typeParameters)
-
-
Method Details
-
from
-
fromNonGeneric
-
getQualifiedName
Description copied from class:TypeReturns the qualified name of the type class.- Specified by:
getQualifiedNamein classType
-
declaration
Returns a source excerpt suitable for declaring this type element.e.g.
MyType<N extends Number, C extends Consumer<N>> -
declarationParameters
Returns a source excerpt of the type parameters of this type element, including bounds and angle brackets.e.g.
<N extends Number, C extends Consumer<N>> -
getTypeParameters
- Specified by:
getTypeParametersin classType
-
addFields
Description copied from class:ValueTypeImplement this method to report the name and value of each field. -
toString
-
addDeclarationParameters
private static void addDeclarationParameters(SourceBuilder source, List<TypeParameterElement> typeParameters) -
extendsObject
-