net.sourceforge.hiveutils.util
Class DefaultMethodMappingBuilder

java.lang.Object
  extended by net.sourceforge.hiveutils.util.DefaultMethodMappingBuilder
All Implemented Interfaces:
MethodMappingBuilder

public class DefaultMethodMappingBuilder
extends java.lang.Object
implements MethodMappingBuilder

Default implementation to generate a mapping between public methods of a source class (or interface) into equivalent methods (same name, same arguments, compatible returned type, but possibly different thrown exceptions).

Author:
Jean-Francois Poilpret

Constructor Summary
DefaultMethodMappingBuilder()
           
 
Method Summary
 java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> buildMapping(java.lang.Class source, java.lang.Class target, MethodMappingErrorHandler handler)
          The method analyses all public methods of source class.
protected  java.lang.reflect.Method mapMethod(java.lang.reflect.Method source, java.lang.Class targetClass, MethodMappingErrorHandler handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMethodMappingBuilder

public DefaultMethodMappingBuilder()
Method Detail

buildMapping

public java.util.Map<java.lang.reflect.Method,java.lang.reflect.Method> buildMapping(java.lang.Class source,
                                                                                     java.lang.Class target,
                                                                                     MethodMappingErrorHandler handler)
The method analyses all public methods of source class. For each method:

If a source method has no target method with matches for name and arguments, then a warning is generated and that method will not appear in the returned Map.

Specified by:
buildMapping in interface MethodMappingBuilder
Parameters:
source - class (or interface) which methods need to be mapped to target
target - class (or interface) to which source methods need to be mapped
handler - the instance that will be called back when errors occur
Returns:
a Map of source Methods to equivalent target Methods

mapMethod

protected java.lang.reflect.Method mapMethod(java.lang.reflect.Method source,
                                             java.lang.Class targetClass,
                                             MethodMappingErrorHandler handler)