public class Types extends Object
Constructor and Description |
---|
Types() |
Modifier and Type | Method and Description |
---|---|
static Type[] |
findClassParameterizedTypes(Class<?> root,
ParameterizedType rootType,
Class<?> searchedForClass) |
static Type[] |
findInterfaceParameterizedTypes(Class<?> root,
ParameterizedType rootType,
Class<?> searchedForInterface) |
static Method |
findOverriddenMethod(Class<?> root,
Class<?> superClass,
Method implementation)
Find the by a method implementation overridden superclass method.
|
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 Class |
getArgumentType(ParameterizedType pType,
int index)
Gets the index-th type argument.
|
static Class |
getCollectionBaseType(Class type,
Type genericType) |
static Method |
getImplementedInterfaceMethod(Class<?> root,
Class<?> iface,
Method implementation)
Find the by a method implementation implemented interface method.
|
static Method |
getImplementingMethod(Class clazz,
Method intfMethod)
Given a method and a root class, find the actual method declared in the root that implements the method.
|
static Class |
getMapKeyType(Type genericType) |
static Class |
getMapValueType(Type genericType) |
static Class<?> |
getRawType(Type type) |
static Class<?> |
getRawTypeNoException(Type type) |
static Class |
getTemplateParameterOfInterface(Class base,
Class desiredInterface) |
static Class<?> |
getTypeArgument(Type genericType)
Returns the type argument from a parameterized type.
|
static boolean |
hasPostConstruct(Class<?> clazz) |
static boolean |
hasPostConstruct(Class<?> clazz,
Function<Method,Boolean> validateParameterCount) |
static boolean |
isA(Class clazz,
ParameterizedType pType)
Is the genericType of a certain class?
|
static boolean |
isCompatible(Method method,
Method intfMethod)
See if the two methods are compatible, that is they have the same relative signature.
|
static Map<TypeVariable<?>,Type> |
populateParameterizedMap(Class<?> root,
Class<?> superClass)
Create a mapping for generic types to actual types between two classes / interfaces of a type hierarchy.
|
static Type |
resolveTypeVariable(Class<?> root,
TypeVariable<?> typeVariable)
Finds an actual value of a type variable.
|
static Type |
resolveTypeVariables(Class<?> root,
Type type) |
public static boolean isA(Class clazz, ParameterizedType pType)
clazz
- classpType
- typepublic static Class getArgumentType(ParameterizedType pType, int index)
pType
- typeindex
- indexpublic static Class getTemplateParameterOfInterface(Class base, Class desiredInterface)
public static boolean isCompatible(Method method, Method intfMethod)
method
- first methodintfMethod
- second methodpublic static Method getImplementingMethod(Class clazz, Method intfMethod)
clazz
- classintfMethod
- methodpublic static Method getImplementedInterfaceMethod(Class<?> root, Class<?> iface, Method implementation)
root
- The root class of the class hierarchy.iface
- The containing interface of the implemented method in the class hierarchy.implementation
- The method implementation.public static Method findOverriddenMethod(Class<?> root, Class<?> superClass, Method implementation)
root
- The root class of the class hierarchy.superClass
- The containing class of the overridden method in the class hierarchy.implementation
- The method implementation.public static Class<?> getTypeArgument(Type genericType)
genericType
- typepublic static Type resolveTypeVariable(Class<?> root, TypeVariable<?> typeVariable)
root
- root classtypeVariable
- type variablepublic static Type[] getActualTypeArgumentsOfAnInterface(Class<?> classToSearch, Class<?> interfaceToFind)
classToSearch
- classinterfaceToFind
- interface to findpublic static Type[] findParameterizedTypes(Class<?> root, Class<?> searchedFor)
root
- root classsearchedFor
- searched classpublic static Type[] findClassParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForClass)
public static Map<TypeVariable<?>,Type> populateParameterizedMap(Class<?> root, Class<?> superClass)
root
- The root class / interface of the type hierarchy.superClass
- A superclass / interface of the type hierarchy.public static Type[] findInterfaceParameterizedTypes(Class<?> root, ParameterizedType rootType, Class<?> searchedForInterface)
public static boolean hasPostConstruct(Class<?> clazz)
Copyright © 2020 JBoss by Red Hat. All rights reserved.