public class Reflections
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.annotation.Annotation[] |
EMPTY_ANNOTATIONS |
static java.lang.Class<?>[] |
EMPTY_CLASSES |
static java.lang.reflect.Type[] |
EMPTY_TYPES |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Map<java.lang.Class<?>,java.lang.reflect.Type> |
buildTypeMap(java.util.Set<java.lang.reflect.Type> types) |
static <T> T |
cast(java.lang.Object obj) |
static void |
checkDeclaringClassLoadable(java.lang.Class<?> c)
Triggers loading of declaring class (if any) of the given class recursively.
|
static boolean |
containsWildcards(java.lang.reflect.Type[] types) |
static java.lang.reflect.Method |
findDeclaredMethodByName(java.lang.Class<?> clazz,
java.lang.String methodName)
Searches for a declared method with a given name.
|
static java.lang.reflect.Type[] |
getActualTypeArguments(java.lang.Class<?> clazz)
Gets the actual type arguments of a class
|
static java.lang.reflect.Type[] |
getActualTypeArguments(java.lang.reflect.Type type)
Gets the actual type arguments of a Type
|
static int |
getNesting(java.lang.Class<?> clazz) |
static java.lang.Object |
getNonPrivateFinalMethodOrType(java.lang.Class<?> type) |
static java.lang.String |
getPropertyName(java.lang.reflect.Method method)
Gets the property name from a getter method.
|
static <T> java.lang.Class<T> |
getRawType(java.lang.reflect.Type type) |
static <T> T |
invokeAndUnwrap(java.lang.Object instance,
java.lang.reflect.Method method,
java.lang.Object... parameters)
Invokes the method on a given instance passing in given parameters.
|
static boolean |
isAbstract(java.lang.Class<?> clazz) |
static boolean |
isAbstract(java.lang.reflect.Method method)
Checks if a method is abstract
|
static boolean |
isArrayType(java.lang.Class<?> rawType)
Checks if raw type is array type
|
static boolean |
isBindings(java.lang.annotation.Annotation binding)
Deprecated.
|
static boolean |
isCacheable(java.lang.annotation.Annotation[] annotations) |
static boolean |
isCacheable(java.util.Collection<java.lang.annotation.Annotation> annotations) |
static boolean |
isClassLoadable(java.lang.String className,
ResourceLoader resourceLoader) |
static boolean |
isFinal(java.lang.Class<?> clazz)
Checks if class is final
|
static boolean |
isFinal(java.lang.reflect.Member member)
Checks if member is final
|
static boolean |
isNonStaticInnerClass(java.lang.Class<?> javaClass) |
static boolean |
isPackagePrivate(int mod) |
static boolean |
isParameterizedType(java.lang.Class<?> type)
Checks if type is parameterized type
|
static boolean |
isParameterizedTypeWithWildcard(java.lang.Class<?> type) |
static boolean |
isPrimitive(java.lang.reflect.Type type) |
static boolean |
isPrivate(java.lang.reflect.Member member)
Checks if member is private
|
static boolean |
isSerializable(java.lang.Class<?> clazz) |
static boolean |
isStatic(java.lang.Class<?> type)
Checks if type is static
|
static boolean |
isStatic(java.lang.reflect.Member member)
Checks if member is static
|
static boolean |
isTransient(java.lang.reflect.Member member) |
static boolean |
isTypeOrAnyMethodFinal(java.lang.Class<?> type)
Checks if type or member is final
|
static boolean |
isUnboundedTypeVariable(java.lang.reflect.Type type) |
static boolean |
isUnboundedWildcard(java.lang.reflect.Type type) |
static <T> java.lang.Class<T> |
loadClass(java.lang.String className,
ResourceLoader resourceLoader)
Tries to load a class using the specified ResourceLoader.
|
public static final java.lang.reflect.Type[] EMPTY_TYPES
public static final java.lang.annotation.Annotation[] EMPTY_ANNOTATIONS
public static final java.lang.Class<?>[] EMPTY_CLASSES
public static java.util.Map<java.lang.Class<?>,java.lang.reflect.Type> buildTypeMap(java.util.Set<java.lang.reflect.Type> types)
public static boolean isCacheable(java.util.Collection<java.lang.annotation.Annotation> annotations)
public static boolean isCacheable(java.lang.annotation.Annotation[] annotations)
public static <T> T cast(java.lang.Object obj)
public static java.lang.String getPropertyName(java.lang.reflect.Method method)
method - The getter methodpublic static boolean isFinal(java.lang.Class<?> clazz)
clazz - The class to checkpublic static int getNesting(java.lang.Class<?> clazz)
public static boolean isFinal(java.lang.reflect.Member member)
member - The member to checkpublic static boolean isPrivate(java.lang.reflect.Member member)
member - The member to checkpublic static boolean isTypeOrAnyMethodFinal(java.lang.Class<?> type)
type - Type or memberpublic static java.lang.Object getNonPrivateFinalMethodOrType(java.lang.Class<?> type)
public static boolean isPackagePrivate(int mod)
public static boolean isStatic(java.lang.Class<?> type)
type - Type to checkpublic static boolean isStatic(java.lang.reflect.Member member)
member - Member to checkpublic static boolean isTransient(java.lang.reflect.Member member)
public static boolean isAbstract(java.lang.reflect.Method method)
method - the methodpublic static boolean isAbstract(java.lang.Class<?> clazz)
public static java.lang.reflect.Type[] getActualTypeArguments(java.lang.Class<?> clazz)
clazz - The class to examinepublic static java.lang.reflect.Type[] getActualTypeArguments(java.lang.reflect.Type type)
type - The type to examinepublic static boolean isArrayType(java.lang.Class<?> rawType)
rawType - The raw type to checkpublic static boolean isParameterizedType(java.lang.Class<?> type)
type - The type to checkpublic static boolean isParameterizedTypeWithWildcard(java.lang.Class<?> type)
public static boolean containsWildcards(java.lang.reflect.Type[] types)
@Deprecated public static boolean isBindings(java.lang.annotation.Annotation binding)
binding - The binding type to checkpublic static boolean isSerializable(java.lang.Class<?> clazz)
public static boolean isPrimitive(java.lang.reflect.Type type)
public static <T> java.lang.Class<T> getRawType(java.lang.reflect.Type type)
public static boolean isClassLoadable(java.lang.String className,
ResourceLoader resourceLoader)
public static <T> java.lang.Class<T> loadClass(java.lang.String className,
ResourceLoader resourceLoader)
className - resourceLoader - public static boolean isUnboundedWildcard(java.lang.reflect.Type type)
public static boolean isUnboundedTypeVariable(java.lang.reflect.Type type)
public static boolean isNonStaticInnerClass(java.lang.Class<?> javaClass)
https://issues.jboss.org/browse/WELD-1081public static <T> T invokeAndUnwrap(java.lang.Object instance,
java.lang.reflect.Method method,
java.lang.Object... parameters)
throws java.lang.Throwable
InvocationTargetException, the exception is unwrapped.
It is a responsibility of the caller to make sure that the method is accessible to the caller.java.lang.Throwablepublic static void checkDeclaringClassLoadable(java.lang.Class<?> c)
LinkageError is propagated.class - the given classjava.lang.LinkageError - or its subclass if a declaring class cannot be loadedpublic static java.lang.reflect.Method findDeclaredMethodByName(java.lang.Class<?> clazz,
java.lang.String methodName)
clazz - the given classmethodName - the given method nameCopyright © 2014. All Rights Reserved.