|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.reflect.base.AbstractGenericType<T>
net.sf.mmm.util.reflect.impl.SimpleGenericTypeImpl<T>
T - is the templated type of the upper
bound.public class SimpleGenericTypeImpl<T>
This is an implementation of the GenericType interface for a simple
Class.
| Field Summary | |
|---|---|
private GenericType<?> |
componentType
|
private GenericType<?> |
keyType
|
private Class<T> |
type
|
static GenericType<?> |
TYPE_INT
The GenericType for int. |
static GenericType<Object> |
TYPE_OBJECT
The GenericType for Object. |
static GenericType<?> |
TYPE_VOID
The GenericType for void. |
| Fields inherited from interface net.sf.mmm.util.reflect.api.GenericType |
|---|
NO_TYPES |
| Constructor Summary | |
|---|---|
SimpleGenericTypeImpl(Class<T> type)
The constructor. |
|
| Method Summary | |
|---|---|
protected GenericType<?> |
create(Type genericType)
This method creates the GenericType that encapsulates the given
type. |
Class<T> |
getAssignmentClass()
This method gets the Class to be used for assignment (as parameter)
of a value of this GenericType. |
GenericType<?> |
getComponentType()
This method gets the component-type of this GenericType if it
represents an array, Collection or Map. |
GenericType<?> |
getDefiningType()
This method gets the defining type. |
GenericType<?> |
getKeyType()
This method gets the key-type of this GenericType if it represents
a Map. |
Class<T> |
getRetrievalClass()
This method gets the Class to be used for retrieval (the
return-type) of a value of this GenericType. |
Type |
getType()
This method gets the Type represented by this GenericType. |
GenericType<?> |
getTypeArgument(int index)
This method gets the type-argument at the given index. |
int |
getTypeArgumentCount()
This method gets the number of type-arguments
. |
| Methods inherited from class net.sf.mmm.util.reflect.base.AbstractGenericType |
|---|
equals, getDeclarationIndex, getGenericDeclarations, hashCode, isAssignableFrom, resolveTypeVariable, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final GenericType<Object> TYPE_OBJECT
GenericType for Object.
public static final GenericType<?> TYPE_VOID
GenericType for void.
public static final GenericType<?> TYPE_INT
GenericType for int.
private final Class<T> type
getType()private GenericType<?> componentType
getComponentType()private GenericType<?> keyType
getKeyType()| Constructor Detail |
|---|
public SimpleGenericTypeImpl(Class<T> type)
type - is the type to represent.| Method Detail |
|---|
protected GenericType<?> create(Type genericType)
GenericType that encapsulates the given
type.
create in class AbstractGenericType<T>genericType - is the Type to get as GenericType.
GenericType.GenericTypeFactory.createGenericType(Type)public GenericType<?> getDefiningType()
Class where the type of this GenericType
was retrieved from as parameter, return-type or field-type.
getDefiningType in class AbstractGenericType<T>null if NOT available.public GenericType<?> getComponentType()
GenericType if it
represents an array, Collection or Map.| type | GenericType.getComponentType() |
|---|---|
List<Map<String, Long>> |
Map<String, Long> |
List |
Object |
Foo[] |
Foo |
Foo<Bar>[] |
Foo<Bar> |
Foo<Bar> |
null |
Map<String, Long> |
Long |
GenericType or null
if this GenericType does NOT represent an array,
Collection or Map.public GenericType<?> getKeyType()
GenericType if it represents
a Map.| type | GenericType.getComponentType() |
|---|---|
List<Map<String, Long>> |
null |
Map |
Object |
Foo[] |
null |
Foo<K,V> |
null |
Map<String, Long> |
String |
GenericType or null if
this GenericType does NOT represent a Map
.public Type getType()
Type represented by this GenericType.
Class.getGenericSuperclass(),
Class.getGenericInterfaces(),
Method.getGenericReturnType(),
Method.getGenericParameterTypes(),
Field.getGenericType(),
Constructor.getGenericParameterTypes()public Class<T> getAssignmentClass()
Class to be used for assignment (as parameter)
of a value of this GenericType.retrieval-class
if this GenericType is a WildcardType.lower-bound, the assignment-class is never null. If there is
no lower-bound, the
assignment-class is the same as the
retrieval-class. Therefore the
assignment-class is always equal or more
specific to the retrieval-class. | Type | GenericType.getAssignmentClass() |
|---|---|
<? super Integer> |
|
<? extends CharSequence> |
|
String |
|
Class that is the lower bound.public Class<T> getRetrievalClass()
Class to be used for retrieval (the
return-type) of a value of this GenericType. assignment-class
if this GenericType is a WildcardType.retrieval-class is the
upper-bound,
however for usability and simplicity only one bound is supported.| Type | GenericType.getAssignmentClass() |
|---|---|
<? super Integer> |
|
<? extends CharSequence> |
|
String |
|
Class that is the upper bound.public GenericType<?> getTypeArgument(int index)
index.GenericType representing
Map<String, List<Integer>> this method would
return String for an index of 0 and
List<Integer> for an index of
1.
index - is the position of the requested type-argument. It has to be
in the range from 0 to
GenericType.getTypeArgumentCount() - 1.
index.GenericType.getTypeArgumentCount(),
ParameterizedType.getActualTypeArguments()public int getTypeArgumentCount()
type-arguments
.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||