public class ReflectionUtilLimitedImpl extends AbstractLoggableComponent implements ReflectionUtilLimited
ReflectionUtilLimited interface. It is strictly GWT compatible.| Modifier and Type | Field and Description |
|---|---|
private static ReflectionUtilLimited |
INSTANCE |
NO_ARGUMENTS, NO_PARAMETERS| Constructor and Description |
|---|
ReflectionUtilLimitedImpl()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T> GenericType<T> |
createGenericType(Class<T> type)
This method creates the
GenericType representing the given type. |
GenericType<?> |
createGenericType(Type type)
This method creates the
GenericType representing the given type. |
GenericType<?> |
createGenericType(Type type,
Class<?> definingType)
This method creates the
GenericType representing the given type in the context of the given
definingType. |
GenericType<?> |
createGenericType(Type type,
GenericType<?> definingType)
This method creates the
GenericType representing the given type in the context of the given
definingType. |
<E> GenericType<List<E>> |
createGenericTypeOfList(GenericType<E> elementType) |
<K,V> GenericType<Map<K,V>> |
createGenericTypeOfMap(GenericType<K> keyType,
GenericType<V> valueType) |
<E> GenericType<Set<E>> |
createGenericTypeOfSet(GenericType<E> elementType) |
static ReflectionUtilLimited |
getInstance() |
<T> Class<T> |
getNonPrimitiveType(Class<T> type)
This method gets the according non-
primitive type for the class given by type. |
createLogger, doInitialize, getLoggerdoInitialized, getInitializationState, initializeprivate static final ReflectionUtilLimited INSTANCE
public static ReflectionUtilLimited getInstance()
public <T> Class<T> getNonPrimitiveType(Class<T> type)
ReflectionUtilLimitedprimitive type for the class given by type.
getNonPrimitiveType(int.class) will return Integer.class.getNonPrimitiveType in interface ReflectionUtilLimitedT - is the generic type of the given type Class.type - is the (potentially) primitive type.type. This will be the given type itself if it is
NOT primitive.Class.isPrimitive()public <T> GenericType<T> createGenericType(Class<T> type)
GenericTypeFactoryGenericType representing the given type. type, lower bound and
upper bound of the returned GenericType will all be identical to
the given type. Type where the given type was
defined you should use
GenericTypeFactory.createGenericType(Type, GenericType) instead to get a more precise result. createGenericType in interface GenericTypeFactoryT - is the generic type of the Class to convert.type - is the Type to represent.GenericType.public GenericType<?> createGenericType(Type type)
GenericTypeFactoryGenericType representing the given type. type is a Class, the methods behaves like GenericTypeFactory.createGenericType(Class). Type where the given type was defined (e.g. the Class where you retrieved
the given type from as parameter, return-type or field-type) you should use
GenericTypeFactory.createGenericType(Type, GenericType) instead to get a more precise result.createGenericType in interface GenericTypeFactorytype - is the Type to represent.GenericType.public GenericType<?> createGenericType(Type type, GenericType<?> definingType)
GenericTypeFactoryGenericType representing the given type in the context of the given
definingType. Now if you ask your self why all this instead of just usingReflectionUtilutil =ReflectionUtilImpl.getInstance(); Class<?> myClass = getSomeClass(); GenericType definingType = util.createGenericType(myClass);MethodmyMethod = findSomeMethod(myClass); Type returnType = myMethod.getGenericReturnType(); GenericType type = util.createGenericType(returnType, definingType); Class<?> returnClass = type.GenericType.getRetrievalClass();
myMethod.
getReturnType()? Read the javadoc of GenericType to get
the answer.mmm-util-pojo which allows to use this features at a higher level and therefore much easier.createGenericType in interface GenericTypeFactorytype - is the Type to represent.definingType - is the GenericType where the given type is defined in. It is needed to resolve
TypeVariables.GenericType.GenericTypeFactory.createGenericType(Type, Class)public GenericType<?> createGenericType(Type type, Class<?> definingType)
GenericTypeFactoryGenericType representing the given type in the context of the given
definingType. createGenericType(type,
createGenericType(definingType))createGenericType in interface GenericTypeFactorytype - is the Type to represent.definingType - is the Class where the given type is defined in. It is needed to resolve
TypeVariables.GenericType.public <E> GenericType<List<E>> createGenericTypeOfList(GenericType<E> elementType)
createGenericTypeOfList in interface GenericTypeFactoryE - the generic type of the List elements.elementType - the GenericType to be bound for <E>.GenericType.public <K,V> GenericType<Map<K,V>> createGenericTypeOfMap(GenericType<K> keyType, GenericType<V> valueType)
createGenericTypeOfMap in interface GenericTypeFactoryK - the generic type of the Map keys.V - the generic type of the Map values.keyType - the GenericType to be bound for <K>.valueType - the GenericType to be bound for <V>.GenericType.public <E> GenericType<Set<E>> createGenericTypeOfSet(GenericType<E> elementType)
createGenericTypeOfSet in interface GenericTypeFactoryE - the generic type of the Set elements.elementType - the GenericType to be bound for <E>.GenericType.Copyright © 2001–2016 mmm-Team. All rights reserved.