public interface GenericTypeDescription extends NamedElement, Iterable<GenericTypeDescription>
TypeDescription is considered to be
a specialization of a generic type.| Modifier and Type | Interface and Description |
|---|---|
static class |
GenericTypeDescription.ForGenericArray
A base implementation of a generic type description that represents a potentially generic array.
|
static class |
GenericTypeDescription.ForNonGenericType
A raw type representation of a non-generic type.
|
static class |
GenericTypeDescription.ForParameterizedType
A base implementation of a generic type description that represents a parameterized type.
|
static class |
GenericTypeDescription.ForTypeVariable
A base implementation of a generic type description that represents a type variable.
|
static class |
GenericTypeDescription.ForWildcardType
A base implementation of a generic type description that represents a wildcard type.
|
static class |
GenericTypeDescription.LazyProjection
A lazy projection of a generic type.
|
static class |
GenericTypeDescription.Sort
Represents a
GenericTypeDescription's form. |
static class |
GenericTypeDescription.SuperTypeIterator
An iterator that iterates over a type's class hierarchy.
|
static interface |
GenericTypeDescription.Visitor<T>
A visitor that can be applied to a
GenericTypeDescription for differentiating on the sort of the visited type. |
NamedElement.WithGenericName, NamedElement.WithRuntimeNameEMPTY_NAME, NO_NAME| Modifier and Type | Method and Description |
|---|---|
<T> T |
accept(GenericTypeDescription.Visitor<T> visitor)
Applies a visitor to this generic type description.
|
TypeDescription |
asErasure()
Returns the erasure of this type.
|
GenericTypeDescription |
getComponentType()
Returns the component type of this type.
|
FieldList<?> |
getDeclaredFields()
Returns a list of field descriptions that are declared by this type.
|
MethodList<?> |
getDeclaredMethods()
Returns a list of method descriptions that are declared by this type.
|
GenericTypeList |
getInterfaces()
Returns the generic interface types of this type.
|
GenericTypeList |
getLowerBounds()
Returns the lower bounds of this type.
|
GenericTypeDescription |
getOwnerType()
Returns the owner type of this type.
|
GenericTypeList |
getParameters()
Returns the type parameters of this type.
|
GenericTypeDescription.Sort |
getSort()
Returns the sort of the generic type this instance represents.
|
StackSize |
getStackSize()
Returns the size of the type described by this instance.
|
GenericTypeDescription |
getSuperType()
Returns the generic super type of this type.
|
String |
getSymbol()
Returns the symbol of this type variable.
|
String |
getTypeName()
Returns the name of the type.
|
GenericTypeList |
getUpperBounds()
Returns the upper bounds of this type.
|
TypeVariableSource |
getVariableSource()
Returns the source of this type variable.
|
boolean |
isArray()
Checks if the type described by this entity is an array.
|
boolean |
isPrimitive()
Checks if the type described by this entity is a primitive type.
|
boolean |
represents(Type type)
Checks if the type described by this instance represents
type. |
getSourceCodeNameforEach, iterator, spliteratorGenericTypeDescription.Sort getSort()
String getTypeName()
Object.toString() representations. For a non-generic
type, it is the fully qualified binary name of the type.TypeDescription asErasure()
GenericTypeDescription.Sort.WILDCARD)
do not have a well-defined erasure and cause an IllegalStateException to be thrown.GenericTypeDescription getSuperType()
Returns the generic super type of this type.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY), a description of Object is returned.
For other generic types, an IllegalStateException is thrown.
null if no such type exists.GenericTypeList getInterfaces()
Returns the generic interface types of this type.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY), a list of Serializable and
Cloneable) is returned. For other generic types, an IllegalStateException is thrown.
FieldList<?> getDeclaredFields()
Returns a list of field descriptions that are declared by this type. For parameterized types, all type variables of these fields are resolved to the values of the type variables.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY), an empty list is returned. For other generic
types, an IllegalStateException is thrown.
MethodList<?> getDeclaredMethods()
Returns a list of method descriptions that are declared by this type. For parameterized types, all type variables used by these methods are resolved to the values of the type variables.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY), an empty list is returned. For other
generic types, an IllegalStateException is thrown.
GenericTypeList getUpperBounds()
Returns the upper bounds of this type. Any type with a well-defined upper bound is bound by at least one type. If no such
type is defined, the bound is implicitly Object.
Only non-symbolic type variables (GenericTypeDescription.Sort.VARIABLE,
GenericTypeDescription.Sort.VARIABLE_DETACHED) and wildcard types
(GenericTypeDescription.Sort.WILDCARD) have well-defined upper bounds. For other
types, an IllegalStateException is thrown.
GenericTypeList getLowerBounds()
Returns the lower bounds of this type.
Only wildcard types (GenericTypeDescription.Sort.WILDCARD) define a lower bound. For other
types, an IllegalStateException is thrown.
GenericTypeDescription getComponentType()
Returns the component type of this type.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and generic array types
GenericTypeDescription.Sort.GENERIC_ARRAY) define a component type. For other
types, an IllegalStateException is thrown.
null if this type does not represent an array type.GenericTypeList getParameters()
Returns the type parameters of this type.
Parameters are only well-defined for parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED), generic array types
(GenericTypeDescription.Sort.GENERIC_ARRAY) and non-generic types
(GenericTypeDescription.Sort.NON_GENERIC). For non-generic and generic array types,
the returned list is always empty. For all other types, this method throws an IllegalStateException.
GenericTypeDescription getOwnerType()
Returns the owner type of this type.
An owner type is only well-defined for parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) , generic array types
(GenericTypeDescription.Sort.GENERIC_ARRAY) and non-generic types
(GenericTypeDescription.Sort.NON_GENERIC). Non-generic types and generic array types do
never have an owner type. For all other types, this method throws an IllegalStateException.
null if no such owner type exists.TypeVariableSource getVariableSource()
GenericTypeDescription.Sort.VARIABLE. For other types, this method
throws an IllegalStateException.String getSymbol()
GenericTypeDescription.Sort.VARIABLE,
GenericTypeDescription.Sort.VARIABLE_DETACHED,
GenericTypeDescription.Sort.VARIABLE_SYMBOLIC). For other types, this method
throws an IllegalStateException.StackSize getStackSize()
GenericTypeDescription.Sort.WILDCARD do not have a well-defined a stack size and
cause an IllegalStateException to be thrown.boolean isArray()
true if this type description represents an array.boolean isPrimitive()
true if this type description represents a primitive type.boolean represents(Type type)
type.type - The type of interest.true if the type described by this instance represents type.<T> T accept(GenericTypeDescription.Visitor<T> visitor)
T - The value that this visitor yields.visitor - The visitor to apply.Copyright © 2014–2015. All rights reserved.