public final class ClassUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<Annotation> |
expandRepeatableAnnotations(Annotation[] list)
Expand repeatable annotations.
|
static List<Annotation> |
expandRepeatableAnnotations(Iterable<Annotation> list)
Expand repeatable annotations.
|
static List<Annotation> |
getAllAnnotations(Class<?> clazz)
Returns all annotations including those on the superclass and implemented interfaces.
|
static Iterable<Field> |
getAllFields(Class<?> cl)
Get all fields from the given class and all its super classes.
|
static ArrayList<Field> |
getAllFieldsInheritedFirst(Class<?> cl)
Get all fields from the given class and all its super classes, with the ones from the root class first.
|
static ArrayList<Method> |
getAllMethodsInheritedFirst(Class<?> cl)
Get all methods from the given class and all its super classes, with the ones from the root class first.
|
static Field |
getField(Class<?> cl,
String name)
Search for a specific field from the given class and its super classes.
|
static Object |
getFieldFromPath(Object object,
String path)
Search for a field using a path.
|
static Method |
getGetter(Class<?> cl,
String name)
Search for a getter method.
|
static Method |
getMethod(Class<?> cl,
String name)
Search for a method.
|
static Method |
getMethod(Class<?> cl,
String name,
int nbParameters)
Search for a method with a name and a specific number of parameters.
|
static Method |
getMethodFor(Class<?> cl,
String name,
Object... params)
Search a method compatible with the given parameters.
|
static List<Method> |
getMethods(Class<?> cl,
String name,
int nbParameters)
Search for a method with a name and a specific number of parameters.
|
static String |
getPackageName(Class<?> cl)
Return the package of the given class.
|
static Method |
getSetter(Class<?> cl,
String name)
Search for a setter method.
|
static boolean |
isMethodParameterCompatibleWith(Class<?> paramType,
Object paramValue)
Return true if paramType can be assigned with paramValue.
|
static boolean |
setFieldFromPath(Object object,
String path,
Object value)
Set a value to a field, using a path.
|
public static Iterable<Field> getAllFields(Class<?> cl)
public static ArrayList<Field> getAllFieldsInheritedFirst(Class<?> cl)
public static ArrayList<Method> getAllMethodsInheritedFirst(Class<?> cl)
public static Field getField(Class<?> cl, String name)
public static String getPackageName(Class<?> cl)
public static Method getMethodFor(Class<?> cl, String name, Object... params)
public static boolean isMethodParameterCompatibleWith(Class<?> paramType, Object paramValue)
public static Method getMethod(Class<?> cl, String name, int nbParameters)
public static List<Method> getMethods(Class<?> cl, String name, int nbParameters)
public static boolean setFieldFromPath(Object object, String path, Object value)
public static Object getFieldFromPath(Object object, String path) throws NoSuchFieldException, IllegalAccessException, InvocationTargetException
public static List<Annotation> getAllAnnotations(Class<?> clazz)
public static List<Annotation> expandRepeatableAnnotations(Annotation[] list)
public static List<Annotation> expandRepeatableAnnotations(Iterable<Annotation> list)
Copyright © 2019. All rights reserved.