T - is the generic type of the retrieval class.public class SimpleGenericTypeLimited<T> extends Object implements GenericType<T>
GenericType that is GWT compatible and therefore limited to core
features.| Modifier and Type | Field and Description |
|---|---|
private GenericType<?> |
componentType |
private GenericType<?> |
keyType |
private Class<T> |
type |
static GenericType<Object> |
TYPE_OBJECT
The
GenericType for Object. |
static GenericType<Void> |
TYPE_VOID
The
GenericType for Void. |
NO_TYPES| Constructor and Description |
|---|
SimpleGenericTypeLimited(Class<T> type)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
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<?> |
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 . |
int |
hashCode() |
boolean |
isAssignableFrom(GenericType<?> subType)
This method determines if this
GenericType is equal to or a super-type of the given
subType. |
private boolean |
isCollection(Class<?> rawType)
This method determines if the given type is a
List. |
private boolean |
isMap(Class<?> rawType)
This method determines if the given type is a
Map. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waittoStringgetTypeNamepublic static final GenericType<Object> TYPE_OBJECT
GenericType for Object.public static final GenericType<Void> TYPE_VOID
GenericType for Void.private GenericType<?> componentType
getComponentType()private GenericType<?> keyType
getKeyType()private boolean isCollection(Class<?> rawType)
List.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 |
getComponentType in interface GenericType<T>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 |
getKeyType in interface GenericType<T>GenericType or null if this GenericType does
NOT represent a Map.public Type getType()
Type represented by this GenericType.getType in interface GenericType<T>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 |
|
getAssignmentClass in interface GenericType<T>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 |
|
getRetrievalClass in interface GenericType<T>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.getTypeArgument in interface GenericType<T>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 .getTypeArgumentCount in interface GenericType<T>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)Copyright © 2001–2015 mmm-Team. All rights reserved.