public static Method getAppropriateMethod ( OgnlContext context , Object source , Object target , String propertyName , String methodName , List methods , Object [ ] args , Object [ ] actualArgs ) { Method result = null ; if ( methods != null ) { Class typeClass = target != null ? target . getClass ( ) : null ; if ( typeClass == null && source != null && Class . class . isInstance ( source ) ) { typeClass = ( Class ) source ; } Class [ ] argClasses = getArgClasses ( args ) ; MatchingMethod mm = findBestMethod ( methods , typeClass , methodName , argClasses ) ; if ( mm != null ) { result = mm . mMethod ; Class [ ] mParameterTypes = mm . mParameterTypes ; System . arraycopy ( args , 0 , actualArgs , 0 , args . length ) ; for ( int j = 0 ; j < mParameterTypes . length ; j ++ ) { Class type = mParameterTypes [ j ] ; if ( mm . report . conversionNeeded [ j ] || ( type . isPrimitive ( ) && ( actualArgs [ j ] == null ) ) ) { actualArgs [ j ] = getConvertedType ( context , source , result , propertyName , args [ j ] , type ) ; } } } } if ( result == null ) { result = getConvertedMethodAndArgs ( context , target , propertyName , methods , args , actualArgs ) ; } return result ; }
Gets the appropriate method to be called for the given target method name and arguments . If successful this method will return the Method within the target that can be called and the converted arguments in actualArgs . If unsuccessful this method will return null and the actualArgs will be empty .