ch.ralscha.extdirectspring.util
Class ExtDirectSpringUtil

java.lang.Object
  extended by ch.ralscha.extdirectspring.util.ExtDirectSpringUtil

public class ExtDirectSpringUtil
extends Object

Utility class

Author:
mansari, Ralph Schaer

Method Summary
static boolean equal(Object a, Object b)
          Checks if two objects are equal.
static MethodInfo findMethodInfo(org.springframework.context.ApplicationContext context, String beanName, String methodName)
          Retrieves a methodInfo from a method in a spring managed bean.
static Method findMethodWithAnnotation(Method method, Class<? extends Annotation> annotation)
          Find a method that is annotated with a specific annotation.
static Object invoke(org.springframework.context.ApplicationContext context, String beanName, MethodInfo methodInfo, Object[] params)
          Invokes a method on a Spring managed bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equal

public static boolean equal(Object a,
                            Object b)
Checks if two objects are equal. Returns true if both objects are null

Parameters:
a - object one
b - object two
Returns:
true if objects are equal

findMethodInfo

public static MethodInfo findMethodInfo(org.springframework.context.ApplicationContext context,
                                        String beanName,
                                        String methodName)
Retrieves a methodInfo from a method in a spring managed bean. The found method will be cached in MethodInfoCache with the key beanName,methodName

Parameters:
context - Spring application context
beanName - name of the bean to find the method in
methodName - name of the method to retrieve
Returns:
the method
Throws:
IllegalArgumentException - if the method is not annotated with a ExtDirectSpring annotation or there is no method in the bean

findMethodWithAnnotation

public static Method findMethodWithAnnotation(Method method,
                                              Class<? extends Annotation> annotation)
Find a method that is annotated with a specific annotation. Starts with the method and goes up to the superclasses of the class.

Parameters:
method - the starting method
annotation - the annotation to look for
Returns:
the method if there is a annotated method, else null

invoke

public static Object invoke(org.springframework.context.ApplicationContext context,
                            String beanName,
                            MethodInfo methodInfo,
                            Object[] params)
                     throws IllegalArgumentException,
                            IllegalAccessException,
                            InvocationTargetException
Invokes a method on a Spring managed bean.

Parameters:
context - a Spring application context
beanName - the name of the bean
methodInfo - the methodInfo object
params - the parameters
Returns:
the result of the method invokation
Throws:
IllegalArgumentException - if there is no bean in the context
IllegalAccessException
InvocationTargetException


Copyright © 2010-2011. All Rights Reserved.