public class TypeVariableSignature extends java.lang.Object implements AnnotatedSignature<TypeVariableSignature>
TypeVariable
on a
GenericDeclaration
produced from a ParameterizedSignature
.Modifier | Constructor and Description |
---|---|
protected |
TypeVariableSignature(java.lang.String name) |
protected |
TypeVariableSignature(java.lang.String name,
java.util.Set<java.lang.reflect.AnnotatedType> bounds,
java.util.Set<java.lang.annotation.Annotation> annotations) |
Modifier and Type | Method and Description |
---|---|
TypeVariableSignature |
annotated(java.util.Collection<? extends java.lang.annotation.Annotation> annotations)
Derive a version of this declaration with the given annotations.
|
java.util.stream.Stream<java.lang.annotation.Annotation> |
getAnnotations() |
java.util.stream.Stream<java.lang.reflect.AnnotatedType> |
getBounds() |
java.lang.String |
getName() |
java.lang.reflect.Type |
reference() |
static java.lang.reflect.Type |
referenceTypeVariable(java.lang.String name)
Type variable declarations intended to have bounds on other type variable
declarations within the same
parameterized
declaration may specify those bounds by reference to the name of the other
type variable. |
java.lang.String |
toString() |
static TypeVariableSignature |
typeVariableSignature(java.lang.String ofName) |
static TypeVariableSignature |
typeVariableSignature(java.lang.reflect.TypeVariable<?> of) |
TypeVariableSignature |
withBounds(java.lang.reflect.AnnotatedType... bounds) |
TypeVariableSignature |
withBounds(java.util.Collection<? extends java.lang.reflect.AnnotatedType> bounds) |
TypeVariableSignature |
withBounds(java.lang.reflect.Type... bounds) |
TypeVariableSignature |
withBounds(TypeToken<?>... bounds) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
annotated
protected TypeVariableSignature(java.lang.String name)
name
- the name of the declared type parameterprotected TypeVariableSignature(java.lang.String name, java.util.Set<java.lang.reflect.AnnotatedType> bounds, java.util.Set<java.lang.annotation.Annotation> annotations)
public static java.lang.reflect.Type referenceTypeVariable(java.lang.String name)
parameterized
declaration
may specify those bounds by reference to the name of the other
type variable. This method creates a placeholder type for this purpose,
which will be substituted with the appropriate TypeVariable
when
the parameterized declaration is actualized into its
definition
.
This is also useful as type variable declarations sometimes need to be
self-referential in their bounds, whether directly or indirectly. Recursive
data structures are difficult to capture naturally through immutable APIs,
but referencing type variable declarations by name rather than by identity
makes this a little simpler.name
- the name of the type variable declaration to create a placeholder
forpublic static TypeVariableSignature typeVariableSignature(java.lang.String ofName)
public static TypeVariableSignature typeVariableSignature(java.lang.reflect.TypeVariable<?> of)
public java.util.stream.Stream<java.lang.annotation.Annotation> getAnnotations()
getAnnotations
in interface AnnotatedSignature<TypeVariableSignature>
public TypeVariableSignature annotated(java.util.Collection<? extends java.lang.annotation.Annotation> annotations)
AnnotatedSignature
Target
, as there is no validation of
applicability.
Annotations already present on the receiving declaration will be replaced rather than appended.
annotated
in interface AnnotatedSignature<TypeVariableSignature>
annotations
- the annotations with which to annotate this declarationpublic java.lang.String getName()
public java.lang.reflect.Type reference()
public java.util.stream.Stream<java.lang.reflect.AnnotatedType> getBounds()
public TypeVariableSignature withBounds(java.lang.reflect.AnnotatedType... bounds)
public TypeVariableSignature withBounds(java.lang.reflect.Type... bounds)
public TypeVariableSignature withBounds(TypeToken<?>... bounds)
public TypeVariableSignature withBounds(java.util.Collection<? extends java.lang.reflect.AnnotatedType> bounds)
public java.lang.String toString()
toString
in interface Signature<TypeVariableSignature>
toString
in class java.lang.Object