|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.oval.internal.util.ReflectionUtils
public final class ReflectionUtils
Method Summary | ||
---|---|---|
static void |
assertPrivateAccessAllowed()
|
|
static Annotation[] |
getAnnotations(Class<?> clazz,
boolean inspectInterfaces)
Returns all annotations present on this class. |
|
static Annotation[] |
getAnnotations(Method method,
boolean inspectInterfaces)
Returns all annotations present on this method. |
|
static Field |
getField(Class<?> clazz,
String fieldName)
|
|
static Field |
getFieldForSetter(Method setter)
|
|
static Field |
getFieldRecursive(Class<?> clazz,
String fieldName)
|
|
static Object |
getFieldValue(Field field,
Object target)
|
|
static Method |
getGetter(Class<?> clazz,
String propertyName)
|
|
static Method |
getGetterRecursive(Class<?> clazz,
String propertyName)
|
|
static List<Method> |
getInterfaceMethods(Method method)
|
|
static Set<Class<?>> |
getInterfacesRecursive(Class<?> clazz)
|
|
static Method |
getMethod(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
|
|
static Method |
getMethodRecursive(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
|
|
static Annotation[][] |
getParameterAnnotations(Method method,
boolean inspectInterfaces)
Returns an array of arrays that represent the annotations on the formal parameters, in declaration order, of the method represented by this method. |
|
static Method |
getSetter(Class<?> clazz,
String propertyName)
|
|
static Method |
getSetterRecursive(Class<?> clazz,
String propertyName)
|
|
static Method |
getSuperMethod(Method method)
|
|
static String |
guessFieldName(Method getter)
|
|
static boolean |
hasField(Class<?> clazz,
String fieldName)
|
|
static boolean |
hasMethod(Class<?> clazz,
String methodName,
Class<?>... parameterTypes)
|
|
static
|
invokeMethod(Method method,
Object obj,
Object... args)
|
|
static boolean |
isAnnotationPresent(Method method,
Class<? extends Annotation> annotationClass,
boolean inspectInterfaces)
Returns true if an annotation for the specified type is present on this method, else false. |
|
static boolean |
isClassPresent(String className)
|
|
static boolean |
isFinal(Member member)
|
|
static boolean |
isGetter(Method method)
determines if a method is a JavaBean style getter method |
|
static boolean |
isNonStaticInnerClass(Class<?> clazz)
|
|
static boolean |
isPackage(Member member)
|
|
static boolean |
isPrivate(Member member)
|
|
static boolean |
isPrivateAccessAllowed()
|
|
static boolean |
isProtected(Member member)
|
|
static boolean |
isPublic(Member member)
|
|
static boolean |
isSetter(Method method)
determines if a method is a JavaBean style setter method |
|
static boolean |
isStatic(Member member)
|
|
static boolean |
isTransient(Member member)
|
|
static boolean |
isVoidMethod(Method method)
determines if a method is a void method |
|
static boolean |
setViaSetter(Object target,
String propertyName,
Object propertyValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void assertPrivateAccessAllowed()
SecurityException
public static Annotation[] getAnnotations(Class<?> clazz, boolean inspectInterfaces)
clazz
- the class to inspectinspectInterfaces
- whether to also return annotations declared on interface declaration
public static Annotation[] getAnnotations(Method method, boolean inspectInterfaces)
method
- the method to inspectinspectInterfaces
- whether to also return annotations declared on interface method declaration
public static Field getField(Class<?> clazz, String fieldName)
public static Field getFieldForSetter(Method setter)
setter
-
public static Field getFieldRecursive(Class<?> clazz, String fieldName)
public static Object getFieldValue(Field field, Object target) throws AccessingFieldValueFailedException
AccessingFieldValueFailedException
public static Method getGetter(Class<?> clazz, String propertyName)
public static Method getGetterRecursive(Class<?> clazz, String propertyName)
public static List<Method> getInterfaceMethods(Method method)
public static Set<Class<?>> getInterfacesRecursive(Class<?> clazz)
clazz
- the class to inspect
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes)
public static Method getMethodRecursive(Class<?> clazz, String methodName, Class<?>... parameterTypes)
public static Annotation[][] getParameterAnnotations(Method method, boolean inspectInterfaces)
method
- the method to inspectinspectInterfaces
- whether to also return annotations declared on interface method declaration
public static Method getSetter(Class<?> clazz, String propertyName)
public static Method getSetterRecursive(Class<?> clazz, String propertyName)
public static Method getSuperMethod(Method method)
public static String guessFieldName(Method getter)
public static boolean hasField(Class<?> clazz, String fieldName)
public static boolean hasMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes)
public static <T> T invokeMethod(Method method, Object obj, Object... args) throws InvokingMethodFailedException, ConstraintsViolatedException
method
- the method to invokeobj
- the object on which to invoke the methodargs
- the method arguments
InvokingMethodFailedException
ConstraintsViolatedException
public static boolean isAnnotationPresent(Method method, Class<? extends Annotation> annotationClass, boolean inspectInterfaces)
method
- the method to inspectannotationClass
- the Class object corresponding to the annotation typeinspectInterfaces
- whether to also check annotations declared on interface method declaration
public static boolean isClassPresent(String className)
public static boolean isFinal(Member member)
public static boolean isGetter(Method method)
public static boolean isNonStaticInnerClass(Class<?> clazz)
public static boolean isPackage(Member member)
public static boolean isPrivate(Member member)
public static boolean isPrivateAccessAllowed()
public static boolean isProtected(Member member)
public static boolean isPublic(Member member)
public static boolean isSetter(Method method)
public static boolean isStatic(Member member)
public static boolean isTransient(Member member)
public static boolean isVoidMethod(Method method)
public static boolean setViaSetter(Object target, String propertyName, Object propertyValue)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |