org.jboss.cache.util.reflect
Class ReflectionUtil

java.lang.Object
  extended by 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)

Constructor Summary
ReflectionUtil()
           
 
Method Summary
static List<Method> getAllMethods(Class c, Class<? extends Annotation> annotationType)
          Returns a set of Methods that contain the given method annotation.
static void invokeAccessibly(Object instance, Method method, Object[] parameters)
          Invokes a method using reflection, in an accessible manner (by using AccessibleObject.setAccessible(boolean)
static void setValue(Object instance, String fieldName, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtil

public ReflectionUtil()
Method Detail

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 inspect
annotationType - 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 method
method - method to execute
parameters - parameters


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.