Rio Project 4.2 API Documentation



org.rioproject.bean
Class BeanHelper

java.lang.Object
  extended by org.rioproject.bean.BeanHelper

public class BeanHelper
extends Object

A utility class that assists in invoking bean lifecycle events, either using annotations or declared method names

Author:
Dennis Reedy

Constructor Summary
BeanHelper()
           
 
Method Summary
static Method getAnnotatedMethod(Object bean, Class<? extends Annotation> annClass)
           
static Class getMethodFirstParamType(Method method)
           
static Class getMethodFirstParamType(String methodName, Object o)
           
static Object invokeBeanMethod(Object bean, Class<? extends Annotation> annClass, String methodName, Class[] classArgs, Object[] objectArgs)
          Helper to invoke a method on the bean using reflection
static void invokeLifeCycle(Class<? extends Annotation> annClass, String methodName, Object bean)
          Invoke a lifecycle method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanHelper

public BeanHelper()
Method Detail

invokeLifeCycle

public static void invokeLifeCycle(Class<? extends Annotation> annClass,
                                   String methodName,
                                   Object bean)
                            throws Exception
Invoke a lifecycle method

Parameters:
annClass - The annotation class to use
methodName - The lifecycle method name to invoke if the annotation is not found
bean - The bean to invoke methods on
Throws:
Exception - of errors occur

invokeBeanMethod

public static Object invokeBeanMethod(Object bean,
                                      Class<? extends Annotation> annClass,
                                      String methodName,
                                      Class[] classArgs,
                                      Object[] objectArgs)
                               throws Exception
Helper to invoke a method on the bean using reflection

Parameters:
bean - The bean to act on
annClass - The annotation class to use
methodName - The method name
classArgs - Class arguments
objectArgs - Object argument
Returns:
The result of dispatching the method
Throws:
Exception - If errors occur

getMethodFirstParamType

public static Class getMethodFirstParamType(String methodName,
                                            Object o)

getMethodFirstParamType

public static Class getMethodFirstParamType(Method method)

getAnnotatedMethod

public static Method getAnnotatedMethod(Object bean,
                                        Class<? extends Annotation> annClass)

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.