Package org.redisson.liveobject.misc
Class ClassUtils
- java.lang.Object
-
- org.redisson.liveobject.misc.ClassUtils
-
public class ClassUtils extends Object
- Author:
- Rui Gu (https://github.com/jackygurui) Modified
-
-
Constructor Summary
Constructors Constructor Description ClassUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Annotation>
TgetAnnotation(Class<?> clazz, Class<T> annotationClass)
static <T extends Annotation>
TgetAnnotation(Class<?> clazz, String fieldName, Class<T> annotationClass)
static Field
getDeclaredField(Class<?> clazz, String fieldName)
static <T> T
getField(Object obj, String fieldName)
static boolean
isAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation)
static Method
searchForMethod(Class<?> type, String name, Class<?>[] parms)
Searches through all methods looking for one with the specified name that will take the specified paramaters even if the parameter types are more generic in the actual method implementation.static void
setField(Object obj, String fieldName, Object value)
-
-
-
Method Detail
-
getAnnotation
public static <T extends Annotation> T getAnnotation(Class<?> clazz, String fieldName, Class<T> annotationClass)
-
getAnnotation
public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> annotationClass)
-
getDeclaredField
public static Field getDeclaredField(Class<?> clazz, String fieldName) throws NoSuchFieldException
- Throws:
NoSuchFieldException
-
isAnnotationPresent
public static boolean isAnnotationPresent(Class<?> clazz, Class<? extends Annotation> annotation)
-
searchForMethod
public static Method searchForMethod(Class<?> type, String name, Class<?>[] parms)
Searches through all methods looking for one with the specified name that will take the specified paramaters even if the parameter types are more generic in the actual method implementation. This is similar to the findConstructor() method and has the similar limitations that it doesn't do a real widening scope search and simply processes the methods in order.- Parameters:
type
- paramname
- of classparms
- classes- Returns:
- Method object
-
-