- java.lang.Object
-
- com.appslandia.common.utils.ReflectionUtils
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceReflectionUtils.FieldHandlerstatic interfaceReflectionUtils.MethodHandler
-
Field Summary
Fields Modifier and Type Field Description static Annotation[]EMPTY_ANNOTATIONSstatic Class<?>[]EMPTY_CLASSESstatic Object[]EMPTY_OBJECTS
-
Constructor Summary
Constructors Constructor Description ReflectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Annotation>
TfindAnnotation(Class<?> clazz, Class<T> annotationClass)static FieldfindField(Class<?> clazz, String property)static MethodfindMethod(Class<?> clazz, String methodName)static List<Method>findMethods(Class<?> clazz, String methodName, Class<?>... parameterTypes)static Objectget(Field m, Object obj)static MethodgetDeclaredMethod(Class<?> clazz, String name, Class<?>... parameterTypes)static ClassLoadergetDefaultClassLoader()static Class<?>getListArgType(Type genericType)static Class<?>[]getMapArgTypes(Type genericType)static Objectinvoke(Method m, Object obj, Object... args)static booleanisImplementOf(Method implMth, Method interfaceMth)static booleanisPublicConst(int modifier)static <T> Class<? extends T>loadClass(String className, ClassLoader loader)static <T> TnewInstance(Class<T> clazz)static voidset(Field m, Object obj, Object value)static Fieldtraverse(Class<?> clazz, ReflectionUtils.FieldHandler handler)static Methodtraverse(Class<?> clazz, ReflectionUtils.MethodHandler handler)
-
-
-
Field Detail
-
EMPTY_OBJECTS
public static final Object[] EMPTY_OBJECTS
-
EMPTY_CLASSES
public static final Class<?>[] EMPTY_CLASSES
-
EMPTY_ANNOTATIONS
public static final Annotation[] EMPTY_ANNOTATIONS
-
-
Method Detail
-
findField
public static Field findField(Class<?> clazz, String property) throws ReflectionException
- Throws:
ReflectionException
-
findMethod
public static Method findMethod(Class<?> clazz, String methodName) throws ReflectionException
- Throws:
ReflectionException
-
findMethods
public static List<Method> findMethods(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws ReflectionException
- Throws:
ReflectionException
-
traverse
public static Field traverse(Class<?> clazz, ReflectionUtils.FieldHandler handler) throws ReflectionException
- Throws:
ReflectionException
-
traverse
public static Method traverse(Class<?> clazz, ReflectionUtils.MethodHandler handler) throws ReflectionException
- Throws:
ReflectionException
-
findAnnotation
public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClass)
-
invoke
public static Object invoke(Method m, Object obj, Object... args) throws ReflectionException
- Throws:
ReflectionException
-
set
public static void set(Field m, Object obj, Object value) throws ReflectionException
- Throws:
ReflectionException
-
get
public static Object get(Field m, Object obj) throws ReflectionException
- Throws:
ReflectionException
-
newInstance
public static <T> T newInstance(Class<T> clazz) throws ReflectionException
- Throws:
ReflectionException
-
loadClass
public static <T> Class<? extends T> loadClass(String className, ClassLoader loader) throws ReflectionException
- Throws:
ReflectionException
-
getDefaultClassLoader
public static ClassLoader getDefaultClassLoader()
-
getDeclaredMethod
public static Method getDeclaredMethod(Class<?> clazz, String name, Class<?>... parameterTypes)
-
isPublicConst
public static boolean isPublicConst(int modifier)
-
-