org.jboss.cache.util.reflect
Class ReflectionUtil
java.lang.Object
org.jboss.cache.util.reflect.ReflectionUtil
public class ReflectionUtil
- extends java.lang.Object
Basic reflection utilities to enhance what the JDK provides.
- Since:
- 2.1.0
- Author:
- Manik Surtani (manik AT jboss DOT org)
Method Summary |
static java.util.List<java.lang.reflect.Method> |
getAllMethods(java.lang.Class c,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns a set of Methods that contain the given method annotation. |
static void |
invokeAccessibly(java.lang.Object instance,
java.lang.reflect.Method method,
java.lang.Object[] parameters)
Invokes a method using reflection, in an accessible manner (by using AccessibleObject.setAccessible(boolean) |
static void |
setValue(java.lang.Object instance,
java.lang.String fieldName,
java.lang.Object value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReflectionUtil
public ReflectionUtil()
getAllMethods
public static java.util.List<java.lang.reflect.Method> getAllMethods(java.lang.Class c,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
- Returns a set of Methods that contain the given method annotation. This includes all public, protected, package and private
methods, as well as those of superclasses. Note that this does *not* include overridden methods.
- Parameters:
c
- class to inspectannotationType
- the type of annotation to look for
- Returns:
- List of Method objects that require injection.
setValue
public static void setValue(java.lang.Object instance,
java.lang.String fieldName,
java.lang.Object value)
invokeAccessibly
public static void invokeAccessibly(java.lang.Object instance,
java.lang.reflect.Method method,
java.lang.Object[] parameters)
- Invokes a method using reflection, in an accessible manner (by using
AccessibleObject.setAccessible(boolean)
- Parameters:
instance
- instance on which to execute the methodmethod
- method to executeparameters
- parameters
Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.