org.gwtwidgets.server.spring
Class ReflectionUtils

java.lang.Object
  extended by org.gwtwidgets.server.spring.ReflectionUtils

public class ReflectionUtils
extends java.lang.Object

Utilities for internal use

Author:
Dmitri Shestakov, dvshestakov[at]gmail.com, Daniel Spangler, George Georgovassilis, g.georgovassilis[at]gmail.com

Constructor Summary
ReflectionUtils()
           
 
Method Summary
static void addAll(java.util.Set<java.lang.Class<?>> set, java.lang.Class<?>[] elements)
          Adds elements of an array to a set.
static
<A extends java.lang.annotation.Annotation>
A
findAnnotation(java.lang.Class<?> clazz, java.lang.Class<A> annotationType)
           
static java.lang.Class<com.google.gwt.user.client.rpc.RemoteService>[] getExposedInterfaces(java.lang.Class<?> clazz)
          Return array of all interfaces that are implemented by clazz and extend RemoteService.
static java.util.Set<java.lang.Class<?>> getInterfaces(java.lang.Class<?> c)
          Return all interfaces that are implemented by this class, traversing super classes and super interfaces.
static java.lang.reflect.Method getRPCMethod(java.lang.Object target, java.lang.Class<?>[] serviceInterfaces, java.lang.reflect.Method method)
          Will try to find method in 'serviceInterfaces' and if found, will attempt to return a method with the same signature from 'service', otherwise an exception is thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getExposedInterfaces

public static java.lang.Class<com.google.gwt.user.client.rpc.RemoteService>[] getExposedInterfaces(java.lang.Class<?> clazz)
Return array of all interfaces that are implemented by clazz and extend RemoteService.

Parameters:
clazz -
Returns:
Array of interfaces. May be empty but never null.

addAll

public static void addAll(java.util.Set<java.lang.Class<?>> set,
                          java.lang.Class<?>[] elements)
Adds elements of an array to a set. The JRE 1.5 does include a similar method in the Collections class, but that breaks GWT-SL 1.4 compatibility.

Parameters:
set -
elements -

getInterfaces

public static java.util.Set<java.lang.Class<?>> getInterfaces(java.lang.Class<?> c)
Return all interfaces that are implemented by this class, traversing super classes and super interfaces.

Parameters:
c -
Returns:
Set of classes. May be empty but not null.

getRPCMethod

public static java.lang.reflect.Method getRPCMethod(java.lang.Object target,
                                                    java.lang.Class<?>[] serviceInterfaces,
                                                    java.lang.reflect.Method method)
                                             throws java.lang.NoSuchMethodException
Will try to find method in 'serviceInterfaces' and if found, will attempt to return a method with the same signature from 'service', otherwise an exception is thrown. If 'serviceInterfaces' is a zero-sized array, the interface check is omitted and the method is looked up directly on the object.

Parameters:
target - Object to search method on
serviceInterfaces - The requested method must exist on at least one of the interfaces
method -
Returns:
Method on 'service' or else a NoSuchMethodException is thrown
Throws:
java.lang.NoSuchMethodException

findAnnotation

public static <A extends java.lang.annotation.Annotation> A findAnnotation(java.lang.Class<?> clazz,
                                                                           java.lang.Class<A> annotationType)


Copyright © 2011. All Rights Reserved.