SPRNET-1339

introduced checks for IsNullableType() into the method matching logic
This commit is contained in:
sbohlen
2011-03-31 17:40:55 +00:00
parent 38bae071b8
commit 3fe86e6d2e
2 changed files with 94 additions and 4 deletions

View File

@@ -310,12 +310,25 @@ namespace Spring.Util
{
Type paramType = parameters[i].ParameterType;
object paramValue = paramValues[i];
#if !NET_2_0
if ((paramValue == null && paramType.IsValueType)
|| (paramValue != null && !paramType.IsAssignableFrom(paramValue.GetType())))
{
isMatch = false;
break;
}
#endif
#if NET_2_0
if ((paramValue == null && paramType.IsValueType && !IsNullableType(paramType))
|| (paramValue != null && !paramType.IsAssignableFrom(paramValue.GetType())))
{
isMatch = false;
break;
}
#endif
if (paramValue == null || paramType != paramValue.GetType())
{
isExactMatch = false;
@@ -1286,6 +1299,21 @@ namespace Spring.Util
return IsTypeVisible(type, null);
}
#if NET_2_0
/// <summary>
/// Determines whether the specified type is nullable.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>
/// <c>true</c> if the specified type is ullable]; otherwise, <c>false</c>.
/// </returns>
public static bool IsTypeNullable(Type type)
{
return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
}
#endif
/// <summary>
/// Is the supplied <paramref name="type"/> can be accessed
/// from the supplied friendly assembly ?