public class ReflectUtil extends Object
| Constructor and Description |
|---|
ReflectUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
boxType(Class<?> type)
Obtain the boxed type of any incoming type.
|
static Method |
getDeclaredMethod(Class<?> klass,
String methodName,
boolean strict,
Object... arguments)
Cherche une methode selon son nom et ses paramètres d'invocation.
|
protected static Method |
getDeclaredMethod(Class<?> klass,
String methodName,
Set<Class<?>> visitedClasses,
Object... arguments) |
static <A extends Annotation> |
getFieldAnnotation(Class<?> objectClass,
Class<A> annotationClass,
boolean deepVisit)
Obtain all the fields with the given annotation type.
|
protected static <A extends Annotation> |
getFieldAnnotation(Class<?> objectClass,
Class<A> annotationClass,
boolean deepVisit,
Set<Class<?>> visitedClasses,
Map<Field,A> result) |
static <A extends Annotation> |
getMethodAnnotation(Class<?> objectClass,
Class<A> annotationClass,
boolean deepVisit)
Obtain all the methods with the given annotation type.
|
protected static <A extends Annotation> |
getMethodAnnotation(Class<?> objectClass,
Class<A> annotationClass,
boolean deepVisit,
Set<Class<?>> visitedClasses,
Map<Method,A> result) |
public static Method getDeclaredMethod(Class<?> klass, String methodName, boolean strict, Object... arguments) throws IllegalArgumentException
klass - la classe dans laquelle rechercher la méthodemethodName - le nom de la méthode recherchéestrict - un drapeau pour déclancher une exception si la méthode
n'est pas trouvéearguments - les arguments d'invocation de la méthodeIllegalArgumentException - si la méthode n'est pas trouvée et que
le drapeau strict est à trueprotected static Method getDeclaredMethod(Class<?> klass, String methodName, Set<Class<?>> visitedClasses, Object... arguments)
public static Class<?> boxType(Class<?> type)
If incoming type is not a primitive type, then just returns himself.
type - the type to boxClass.isPrimitive()public static <A extends Annotation> Map<Field,A> getFieldAnnotation(Class<?> objectClass, Class<A> annotationClass, boolean deepVisit)
Note: This method will scan deeply the given type
if parameter deepVisit is setted to true.
Note: The type Object will not be scanned.
A - type of annotation to scanobjectClass - the type to scanannotationClass - the type of annotation to scandeepVisit - flag to visit deeply the class (if set to
true, will also scan super classes
and interfaces)public static <A extends Annotation> Map<Method,A> getMethodAnnotation(Class<?> objectClass, Class<A> annotationClass, boolean deepVisit)
deepVisit is setted to true.
Note: The type Object will not be scanned.A - type of annotation to scanobjectClass - the type to scanannotationClass - the type of annotation to scandeepVisit - flag to visit deeply the class (if set to
true, will also scan super classes
and interfaces)protected static <A extends Annotation> void getFieldAnnotation(Class<?> objectClass, Class<A> annotationClass, boolean deepVisit, Set<Class<?>> visitedClasses, Map<Field,A> result)
Copyright © 2008–2018 Ultreia.io. All rights reserved.