Package com.squareup.javapoet
Class TypeVariableName
- java.lang.Object
-
- com.squareup.javapoet.TypeName
-
- com.squareup.javapoet.TypeVariableName
-
public final class TypeVariableName extends TypeName
-
-
Constructor Summary
Constructors Modifier Constructor Description private
TypeVariableName(java.lang.String name, java.util.List<TypeName> bounds)
private
TypeVariableName(java.lang.String name, java.util.List<TypeName> bounds, java.util.List<AnnotationSpec> annotations)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeVariableName
annotated(java.util.List<AnnotationSpec> annotations)
(package private) CodeWriter
emit(CodeWriter out)
static TypeVariableName
get(java.lang.reflect.TypeVariable<?> type)
Returns type variable equivalent totype
.(package private) static TypeVariableName
get(java.lang.reflect.TypeVariable<?> type, java.util.Map<java.lang.reflect.Type,TypeVariableName> map)
static TypeVariableName
get(java.lang.String name)
Returns type variable namedname
without bounds.static TypeVariableName
get(java.lang.String name, TypeName... bounds)
Returns type variable namedname
withbounds
.static TypeVariableName
get(java.lang.String name, java.lang.reflect.Type... bounds)
Returns type variable namedname
withbounds
.static TypeVariableName
get(javax.lang.model.element.TypeParameterElement element)
Returns type variable equivalent toelement
.static TypeVariableName
get(javax.lang.model.type.TypeVariable mirror)
Returns type variable equivalent tomirror
.(package private) static TypeVariableName
get(javax.lang.model.type.TypeVariable mirror, java.util.Map<javax.lang.model.element.TypeParameterElement,TypeVariableName> typeVariables)
Make a TypeVariableName for the given TypeMirror.private static TypeVariableName
of(java.lang.String name, java.util.List<TypeName> bounds)
TypeVariableName
withBounds(TypeName... bounds)
TypeVariableName
withBounds(java.lang.reflect.Type... bounds)
TypeVariableName
withBounds(java.util.List<TypeName> bounds)
TypeName
withoutAnnotations()
-
Methods inherited from class com.squareup.javapoet.TypeName
annotated, arrayComponent, box, concatAnnotations, emitAnnotations, equals, get, get, get, get, hashCode, isAnnotated, isBoxedPrimitive, isPrimitive, list, list, toString, unbox
-
-
-
-
Field Detail
-
name
public final java.lang.String name
-
bounds
public final java.util.List<TypeName> bounds
-
-
Constructor Detail
-
TypeVariableName
private TypeVariableName(java.lang.String name, java.util.List<TypeName> bounds)
-
TypeVariableName
private TypeVariableName(java.lang.String name, java.util.List<TypeName> bounds, java.util.List<AnnotationSpec> annotations)
-
-
Method Detail
-
annotated
public TypeVariableName annotated(java.util.List<AnnotationSpec> annotations)
-
withoutAnnotations
public TypeName withoutAnnotations()
- Overrides:
withoutAnnotations
in classTypeName
-
withBounds
public TypeVariableName withBounds(java.lang.reflect.Type... bounds)
-
withBounds
public TypeVariableName withBounds(TypeName... bounds)
-
withBounds
public TypeVariableName withBounds(java.util.List<TypeName> bounds)
-
of
private static TypeVariableName of(java.lang.String name, java.util.List<TypeName> bounds)
-
emit
CodeWriter emit(CodeWriter out) throws java.io.IOException
-
get
public static TypeVariableName get(java.lang.String name)
Returns type variable namedname
without bounds.
-
get
public static TypeVariableName get(java.lang.String name, TypeName... bounds)
Returns type variable namedname
withbounds
.
-
get
public static TypeVariableName get(java.lang.String name, java.lang.reflect.Type... bounds)
Returns type variable namedname
withbounds
.
-
get
public static TypeVariableName get(javax.lang.model.type.TypeVariable mirror)
Returns type variable equivalent tomirror
.
-
get
static TypeVariableName get(javax.lang.model.type.TypeVariable mirror, java.util.Map<javax.lang.model.element.TypeParameterElement,TypeVariableName> typeVariables)
Make a TypeVariableName for the given TypeMirror. This form is used internally to avoid infinite recursion in cases likeEnum<E extends Enum<E>>
. When we encounter such a thing, we will make a TypeVariableName without bounds and add that to thetypeVariables
map before looking up the bounds. Then if we encounter this TypeVariable again while constructing the bounds, we can just return it from the map. And, the code that put the entry invariables
will make sure that the bounds are filled in before returning.
-
get
public static TypeVariableName get(javax.lang.model.element.TypeParameterElement element)
Returns type variable equivalent toelement
.
-
get
public static TypeVariableName get(java.lang.reflect.TypeVariable<?> type)
Returns type variable equivalent totype
.
-
get
static TypeVariableName get(java.lang.reflect.TypeVariable<?> type, java.util.Map<java.lang.reflect.Type,TypeVariableName> map)
- See Also:
get(java.lang.reflect.TypeVariable, Map)
-
-