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. |
boolean |
isCollection() |
boolean |
isMap() |
protected Type |
resolveTypeVariable(TypeVariable<?> typeVariable,
GenericType<?> declaringType)
This method resolves the given
typeVariable in the context of the given declaringType. |
private Type |
resolveTypeVariable(TypeVariable<?> typeVariable,
GenericType<?> declaringType,
Class<?> declaringClass)
This method recursively resolves the given
typeVariable in the context of the given
declaringType. |
String |
toString()
This method gets the string representation of this
GenericType. |
String |
toStringSimple() |
protected GenericTypeVariable<?> |
wrap(TypeVariable<?> typeVariable) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAssignmentClass, getComponentType, getKeyType, getRetrievalClass, getType, getTypeArgument, getTypeArgumentCountgetTypeNameprotected 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.protected GenericTypeVariable<?> wrap(TypeVariable<?> typeVariable)
typeVariable - the TypeVariable to wrap.TypeVariable wrapped as GenericTypeVariable.public boolean isAssignableFrom(GenericType<?> subType)
GenericTypeGenericType 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)public boolean isMap()
isMap in interface GenericType<T>true if this GenericType represents a Map.public boolean isCollection()
isCollection in interface GenericType<T>true if this GenericType represents a Collection.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-Types 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 - the TypeVariable to resolve.declaringType - 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) .private Type resolveTypeVariable(TypeVariable<?> typeVariable, GenericType<?> declaringType, Class<?> declaringClass)
typeVariable in the context of the given
declaringType.typeVariable - the TypeVariable to resolve.declaringType - the GenericType where the given typeVariable occurs or is replaced.declaringClass - the declaring class.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()
GenericTypeGenericType. 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 ObjectGenericType as string.public String toStringSimple()
toStringSimple in interface GenericType<T>simple names for Classes.ReflectionUtil.toStringSimple(Type)Copyright © 2001–2019 mmm-Team. All rights reserved.