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. |
boolean |
isCollection() |
private boolean |
isCollection(Class<?> rawType)
This method determines if the given type is a
List. |
boolean |
isMap() |
private boolean |
isMap(Class<?> rawType)
This method determines if the given type is a
Map. |
String |
toString()
This method gets the string representation of this
GenericType. |
String |
toStringSimple() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTypeNamepublic static final GenericType<Object> TYPE_OBJECT
GenericType for Object.public static final GenericType<Void> TYPE_VOID
GenericType for Void.private GenericType<?> componentType
private GenericType<?> keyType
private boolean isCollection(Class<?> rawType)
List.public GenericType<?> getComponentType()
GenericTypeGenericType 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()
GenericTypeGenericType 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 |
| HashMap<? extends Number, Long> | ? extends Number |
getKeyType in interface GenericType<T>GenericType or null if this GenericType does NOT represent a
Map.public Type getType()
GenericTypeType 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()
GenericTypeClass 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> | Integer |
| <? extends CharSequence> | CharSequence |
String |
String |
getAssignmentClass in interface GenericType<T>Class that is the lower bound.public Class<T> getRetrievalClass()
GenericTypeClass 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> | Object |
| <? extends CharSequence> | CharSequence |
String |
String |
getRetrievalClass in interface GenericType<T>Class that is the upper bound.public GenericType<?> getTypeArgument(int index)
GenericTypeindex. 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()
GenericTypetype-arguments .getTypeArgumentCount in interface GenericType<T>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.public 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.