in src/main/java/org/apache/commons/ognl/OgnlRuntime.java [797:842]
public static Method getAppropriateMethod( OgnlContext context, Object source, Object target, String propertyName,
List<Method> methods, Object[] args, Object[] actualArgs )
{
Method appropriateMethod = null;
Class<?>[] resultParameterTypes = null;
if ( methods != null )
{
for ( Method method : methods )
{
Class<?> typeClass = target != null ? target.getClass() : null;
if ( typeClass == null && source != null && source instanceof Class)
{
typeClass = (Class<?>) source;
}
Class<?>[] mParameterTypes = findParameterTypes( typeClass, method );
if ( areArgsCompatible( args, mParameterTypes, method ) &&
( ( appropriateMethod == null ) || isMoreSpecific( mParameterTypes, resultParameterTypes ) ) )
{
appropriateMethod = method;
resultParameterTypes = mParameterTypes;
System.arraycopy( args, 0, actualArgs, 0, args.length );
for ( int i = 0; i < mParameterTypes.length; i++ )
{
Class<?> type = mParameterTypes[i];
if ( type.isPrimitive() && ( actualArgs[i] == null ) )
{
actualArgs[i] = getConvertedType( context, source, appropriateMethod, propertyName, null, type );
}
}
}
}
}
if ( appropriateMethod == null )
{
appropriateMethod = getConvertedMethodAndArgs( context, target, propertyName, methods, args, actualArgs );
}
return appropriateMethod;
}