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 privateTypeVariableName(java.lang.String name, java.util.List<TypeName> bounds)privateTypeVariableName(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 TypeVariableNameannotated(java.util.List<AnnotationSpec> annotations)(package private) CodeWriteremit(CodeWriter out)static TypeVariableNameget(java.lang.reflect.TypeVariable<?> type)Returns type variable equivalent totype.(package private) static TypeVariableNameget(java.lang.reflect.TypeVariable<?> type, java.util.Map<java.lang.reflect.Type,TypeVariableName> map)static TypeVariableNameget(java.lang.String name)Returns type variable namednamewithout bounds.static TypeVariableNameget(java.lang.String name, TypeName... bounds)Returns type variable namednamewithbounds.static TypeVariableNameget(java.lang.String name, java.lang.reflect.Type... bounds)Returns type variable namednamewithbounds.static TypeVariableNameget(javax.lang.model.element.TypeParameterElement element)Returns type variable equivalent toelement.static TypeVariableNameget(javax.lang.model.type.TypeVariable mirror)Returns type variable equivalent tomirror.(package private) static TypeVariableNameget(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 TypeVariableNameof(java.lang.String name, java.util.List<TypeName> bounds)TypeVariableNamewithBounds(TypeName... bounds)TypeVariableNamewithBounds(java.lang.reflect.Type... bounds)TypeVariableNamewithBounds(java.util.List<? extends TypeName> bounds)TypeNamewithoutAnnotations()-
Methods inherited from class com.squareup.javapoet.TypeName
annotated, arrayComponent, asArray, 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:
withoutAnnotationsin classTypeName
-
withBounds
public TypeVariableName withBounds(java.lang.reflect.Type... bounds)
-
withBounds
public TypeVariableName withBounds(TypeName... bounds)
-
withBounds
public TypeVariableName withBounds(java.util.List<? extends 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 namednamewithout bounds.
-
get
public static TypeVariableName get(java.lang.String name, TypeName... bounds)
Returns type variable namednamewithbounds.
-
get
public static TypeVariableName get(java.lang.String name, java.lang.reflect.Type... bounds)
Returns type variable namednamewithbounds.
-
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 thetypeVariablesmap 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 invariableswill 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)
-
-