public class Reflections extends Object
Modifier and Type | Field and Description |
---|---|
static Annotation[] |
EMPTY_ANNOTATIONS |
static Class<?>[] |
EMPTY_CLASSES |
static Type[] |
EMPTY_TYPES |
Modifier and Type | Method and Description |
---|---|
static Map<Class<?>,Type> |
buildTypeMap(Set<Type> types) |
static <T> T |
cast(Object obj) |
static boolean |
containsWildcards(Type[] types) |
static Type[] |
getActualTypeArguments(Class<?> clazz)
Gets the actual type arguments of a class
|
static Type[] |
getActualTypeArguments(Type type)
Gets the actual type arguments of a Type
|
static int |
getNesting(Class<?> clazz) |
static Object |
getNonPrivateFinalMethodOrType(Class<?> type) |
static String |
getPropertyName(Method method)
Gets the property name from a getter method.
|
static <T> Class<T> |
getRawType(Type type) |
static <T> T |
invokeAndUnwrap(Object instance,
Method method,
Object... parameters)
Invokes the method on a given instance passing in given parameters.
|
static boolean |
isAbstract(Class<?> clazz) |
static boolean |
isAbstract(Method method)
Checks if a method is abstract
|
static boolean |
isArrayType(Class<?> rawType)
Checks if raw type is array type
|
static boolean |
isBindings(Annotation binding)
Deprecated.
|
static boolean |
isCacheable(Annotation[] annotations) |
static boolean |
isCacheable(Collection<Annotation> annotations) |
static boolean |
isClassLoadable(String className,
org.jboss.weld.resources.spi.ResourceLoader resourceLoader) |
static boolean |
isFinal(Class<?> clazz)
Checks if class is final
|
static boolean |
isFinal(Member member)
Checks if member is final
|
static boolean |
isNonStaticInnerClass(Class<?> javaClass) |
static boolean |
isPackagePrivate(int mod) |
static boolean |
isParameterizedType(Class<?> type)
Checks if type is parameterized type
|
static boolean |
isParameterizedTypeWithWildcard(Class<?> type) |
static boolean |
isPrimitive(Type type) |
static boolean |
isPrivate(Member member)
Checks if member is private
|
static boolean |
isSerializable(Class<?> clazz) |
static boolean |
isStatic(Class<?> type)
Checks if type is static
|
static boolean |
isStatic(Member member)
Checks if member is static
|
static boolean |
isTransient(Member member) |
static boolean |
isTypeOrAnyMethodFinal(Class<?> type)
Checks if type or member is final
|
static boolean |
isUnboundedTypeVariable(Type type) |
static boolean |
isUnboundedWildcard(Type type) |
static <T> Class<T> |
loadClass(String className,
org.jboss.weld.resources.spi.ResourceLoader resourceLoader)
Tries to load a class using the specified ResourceLoader.
|
public static final Type[] EMPTY_TYPES
public static final Annotation[] EMPTY_ANNOTATIONS
public static final Class<?>[] EMPTY_CLASSES
public static boolean isCacheable(Collection<Annotation> annotations)
public static boolean isCacheable(Annotation[] annotations)
public static <T> T cast(Object obj)
public static String getPropertyName(Method method)
method
- The getter methodpublic static boolean isFinal(Class<?> clazz)
clazz
- The class to checkpublic static int getNesting(Class<?> clazz)
public static boolean isFinal(Member member)
member
- The member to checkpublic static boolean isPrivate(Member member)
member
- The member to checkpublic static boolean isTypeOrAnyMethodFinal(Class<?> type)
type
- Type or memberpublic static boolean isPackagePrivate(int mod)
public static boolean isStatic(Class<?> type)
type
- Type to checkpublic static boolean isStatic(Member member)
member
- Member to checkpublic static boolean isTransient(Member member)
public static boolean isAbstract(Method method)
method
- the methodpublic static boolean isAbstract(Class<?> clazz)
public static Type[] getActualTypeArguments(Class<?> clazz)
clazz
- The class to examinepublic static Type[] getActualTypeArguments(Type type)
type
- The type to examinepublic static boolean isArrayType(Class<?> rawType)
rawType
- The raw type to checkpublic static boolean isParameterizedType(Class<?> type)
type
- The type to checkpublic static boolean isParameterizedTypeWithWildcard(Class<?> type)
public static boolean containsWildcards(Type[] types)
@Deprecated public static boolean isBindings(Annotation binding)
binding
- The binding type to checkpublic static boolean isSerializable(Class<?> clazz)
public static boolean isPrimitive(Type type)
public static boolean isClassLoadable(String className, org.jboss.weld.resources.spi.ResourceLoader resourceLoader)
public static <T> Class<T> loadClass(String className, org.jboss.weld.resources.spi.ResourceLoader resourceLoader)
className
- resourceLoader
- public static boolean isUnboundedWildcard(Type type)
public static boolean isUnboundedTypeVariable(Type type)
public static boolean isNonStaticInnerClass(Class<?> javaClass)
https://issues.jboss.org/browse/WELD-1081
public static <T> T invokeAndUnwrap(Object instance, Method method, Object... parameters) throws Throwable
InvocationTargetException
, the exception is unwrapped.
It is a responsibility of the caller to make sure that the method is accessible to the caller.Throwable
Copyright © 2016. All rights reserved.