T
- is the templated type of the upper bound
.public abstract class AbstractGenericType<T> extends Object implements GenericType<T>
GenericType
interface.NO_TYPES
Modifier | Constructor and Description |
---|---|
protected |
AbstractGenericType()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract GenericType<?> |
create(Type type)
This method creates the
GenericType that encapsulates the given type . |
boolean |
equals(Object other) |
protected int |
getDeclarationIndex(TypeVariable<?> typeVariable)
This method gets the declaration-index of the given
typeVariable . |
abstract GenericType<?> |
getDefiningType()
This method gets the defining type.
|
protected List<Type> |
getGenericDeclarations(Class<?> ancestor,
Class<?> descendant)
This method walks up the
Class -hierarchy from descendant up to ancestor
and collects the generic super-classes or
super-interfaces of ancestor on that hierarchy-path. |
int |
hashCode() |
boolean |
isAssignableFrom(GenericType<?> subType)
This method determines if this
GenericType is equal to or a super-type of the given
subType . |
protected Type |
resolveTypeVariable(TypeVariable<?> typeVariable,
GenericType<?> declaringType)
This method resolves the given
typeVariable in the context of the given
declaringType . |
String |
toString()
This method gets the string representation of this
GenericType . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAssignmentClass, getComponentType, getKeyType, getRetrievalClass, getType, getTypeArgument, getTypeArgumentCount
getTypeName
protected abstract GenericType<?> create(Type type)
GenericType
that encapsulates the given type
.type
- is the Type
to get as GenericType
.GenericType
.GenericTypeFactory.createGenericType(Type)
public abstract GenericType<?> getDefiningType()
Class
where the type
of this GenericType
was retrieved from as parameter, return-type or field-type.null
if NOT available.public boolean isAssignableFrom(GenericType<?> subType)
GenericType
is equal to or a super-type of the given
subType
. X.isAssignableFrom(Y)
is true
, then an instance of Y
can be
casted to X
. isAssignableFrom
in interface GenericType<T>
subType
- is the potential sub-type of this GenericType
.true
if objects of the type subType
can be assigned to this
GenericType
.Class.isAssignableFrom(Class)
protected List<Type> getGenericDeclarations(Class<?> ancestor, Class<?> descendant)
Class
-hierarchy from descendant
up to ancestor
and collects the generic super-classes
or
super-interfaces
of ancestor
on that hierarchy-path. ancestor
is an interface
, the hierarchy may
NOT be unique. In such case it will be unspecified which of the possible paths is used.ancestor
- is the super-class or super-interface of descendant
.descendant
- is the sub-class or sub-interface of ancestor
.List
of the generic super-Type
s from descendant
up to
ancestor
, where the first element represents the super-Type
of
descendant
and the last element represents the generic declaration of
ancestor
itself.protected int getDeclarationIndex(TypeVariable<?> typeVariable)
typeVariable
.typeVariable
- is the TypeVariable
.typeVariable
in its
declaration
.protected Type resolveTypeVariable(TypeVariable<?> typeVariable, GenericType<?> declaringType)
typeVariable
in the context of the given
declaringType
.typeVariable
- is the TypeVariable
to resolve.declaringType
- is the GenericType
where the given typeVariable
occurs or is
replaced.Type
or null
if the given typeVariable
could NOT
be resolved (e.g. it was declared
in a Class
that is NOT assignable from
the given
declaringType
) .public final String toString()
GenericType
. In case the underlying
value-type
is a regular Class
, this method will return its
qualified name
otherwise it will return the string representation of the generic
type information (e.g.
java.util.Map<java.lang.String, java.util.List<java.lang.Integer>>[]
).toString
in interface GenericType<T>
toString
in class Object
GenericType
as string.Copyright © 2001–2014 mmm-Team. All rights reserved.