Package org.jboss.resteasy.util
Class Types
java.lang.Object
org.jboss.resteasy.util.Types
Type conversions and generic type manipulations
- Version:
- $Revision: 1 $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Type[]extractTypes(Map<String, Type> typeVarMap, Type genericSub) private static Type[]extractTypeVariables(Map<String, Type> typeVarMap, Type[] types) static Type[]findClassParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForClass) static Type[]findInterfaceParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForInterface) static Type[]findParameterizedTypes(Class<?> root, Class<?> searchedFor) Search for the given interface or class within the root's class/interface hierarchy.static Type[]getActualTypeArgumentsOfAnInterface(Class<?> classToSearch, Class<?> interfaceToFind) Given a class and an interfaces, go through the class hierarchy to find the interface and return its type arguments.static ClassgetArgumentType(ParameterizedType pType, int index) Gets the index-th type argument.static ClassgetCollectionBaseType(Class type, Type genericType) static MethodgetImplementingMethod(Class clazz, Method intfMethod) Given a method and a root class, find the actual method declared in the root that implements the method.static ClassgetMapKeyType(Type genericType) static ClassgetMapValueType(Type genericType) static Class<?> getRawType(Type type) static Class<?> getRawTypeNoException(Type type) static ClassgetTemplateParameterOfInterface(Class base, Class desiredInterface) static Class<?> getTypeArgument(Type genericType) Returns the type argument from a parameterized typestatic booleanisA(Class clazz, ParameterizedType pType) Is the genericType of a certain class?static booleanisCompatible(Method method, Method intfMethod) See if the two methods are compatible, that is they have the same relative signaturepopulateParameterizedMap(Class<?> root, ParameterizedType rootType) private static Type[]recurseSuperclassForInterface(Class<?> searchedForInterface, Map<String, Type> typeVarMap, Type genericSub, Class<?> sub) static TyperesolveTypeVariable(Class<?> root, TypeVariable<?> typeVariable) Finds an actual value of a type variable.static TyperesolveTypeVariables(Class<?> root, Type type) private static ObjectsearchForInterfaceTemplateParameter(Class base, Class desiredInterface)
-
Field Details
-
EMPTY_TYPE_ARRAY
-
-
Constructor Details
-
Types
public Types()
-
-
Method Details
-
isA
Is the genericType of a certain class? -
getArgumentType
Gets the index-th type argument. -
getTemplateParameterOfInterface
-
searchForInterfaceTemplateParameter
-
isCompatible
See if the two methods are compatible, that is they have the same relative signature- Parameters:
method-intfMethod-- Returns:
-
getImplementingMethod
Given a method and a root class, find the actual method declared in the root that implements the method.- Parameters:
clazz-intfMethod-- Returns:
-
getRawType
-
getRawTypeNoException
-
getTypeArgument
Returns the type argument from a parameterized type- Parameters:
genericType-- Returns:
- null if there is no type parameter
-
getCollectionBaseType
-
getMapKeyType
-
getMapValueType
-
resolveTypeVariables
-
resolveTypeVariable
Finds an actual value of a type variable. The method looks in a class hierarchy for a class defining the variable and returns the value if present.- Parameters:
root-typeVariable-- Returns:
- actual type of the type variable
-
getActualTypeArgumentsOfAnInterface
public static Type[] getActualTypeArgumentsOfAnInterface(Class<?> classToSearch, Class<?> interfaceToFind) Given a class and an interfaces, go through the class hierarchy to find the interface and return its type arguments.- Parameters:
classToSearch-interfaceToFind-- Returns:
- type arguments of the interface
-
findParameterizedTypes
Search for the given interface or class within the root's class/interface hierarchy. If the searched for class/interface is a generic return an array of real types that fill it out.- Parameters:
root-searchedFor-- Returns:
-
findClassParameterizedTypes
public static Type[] findClassParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForClass) -
populateParameterizedMap
-
findInterfaceParameterizedTypes
public static Type[] findInterfaceParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForInterface) -
recurseSuperclassForInterface
-
extractTypeVariables
-
extractTypes
-