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. |
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
getInstance()public static ReflectionUtilLimited getInstance()
public <T> Class<T> getNonPrimitiveType(Class<T> type)
primitive 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)
GenericType 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)
GenericType 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)
GenericType 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)
GenericType 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.Copyright © 2001–2015 mmm-Team. All rights reserved.