org.jboss.cache.util.reflect
Class ReflectionUtil
java.lang.Object
org.jboss.cache.util.reflect.ReflectionUtil
public class ReflectionUtil
- extends Object
Basic reflection utilities to enhance what the JDK provides.
- Since:
- 2.1.0
- Author:
- Manik Surtani (manik AT jboss DOT org)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReflectionUtil
public ReflectionUtil()
getAllMethods
public static List<Method> getAllMethods(Class c,
Class<? extends 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(Object instance,
String fieldName,
Object value)
invokeAccessibly
public static void invokeAccessibly(Object instance,
Method method,
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.