com.smhumayun.mi_plus.impl
Class MIMethodResolverImpl

java.lang.Object
  extended by com.smhumayun.mi_plus.impl.MIMethodResolverImpl
All Implemented Interfaces:
MIMethodResolver

public final class MIMethodResolverImpl
extends Object
implements MIMethodResolver

MIMethodResolver implementation which resolves method based on the order of MISupport.parentClasses() and method resolution strategy of Apache Commons MethodUtils.getMatchingAccessibleMethod(Class, String, Class[])

Since:
1.0
Author:
smhumayun

Constructor Summary
MIMethodResolverImpl()
           
 
Method Summary
 Pair<Object,Method> resolve(Class miContainerClass, LinkedHashMap<Class,Object> composedObjects, Method methodCall, Object[] methodCallArgs)
          Resolve method based on following strategy: - Iterate over composed objects (order will be the same as defined in MISupport - For each composed object, check if there's a matching 'accessible' method based on the algorithm defined by MethodUtils.getAccessibleMethod(Class, String, Class[]) i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MIMethodResolverImpl

public MIMethodResolverImpl()
Method Detail

resolve

public Pair<Object,Method> resolve(Class miContainerClass,
                                   LinkedHashMap<Class,Object> composedObjects,
                                   Method methodCall,
                                   Object[] methodCallArgs)
                            throws MIException
Resolve method based on following strategy: - Iterate over composed objects (order will be the same as defined in MISupport - For each composed object, check if there's a matching 'accessible' method based on the algorithm defined by MethodUtils.getAccessibleMethod(Class, String, Class[]) i.e. it finds an accessible method that matches the given name and has compatible parameters. Compatible parameters mean that every method parameter is assignable from the given parameters. In other words, it finds a method with the given name that will take the parameters given. - If a match is found, break the iteration and exit from the loop; - Return the corresponding composed object and the matched method

Specified by:
resolve in interface MIMethodResolver
Parameters:
miContainerClass - MI Container class
composedObjects - map of composed objects
methodCall - method call made on Proxy
methodCallArgs - method call arguments
Returns:
resolved target method and object
Throws:
MIException - MIException


Copyright © 2013–2015 Syed Muhammad Humayun - smhumayun@gmail.com. All rights reserved.