Author: hlship
Date: Sat Apr 2 00:34:34 2011
New Revision: 1087941
URL: http://svn.apache.org/viewvc?rev=1087941&view=rev
Log:
TAP5-1383: TypeCoercer should "promote" coercions to primitive types into
coercions to the corresponding wrapper type
Modified:
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/CoercionTuple.java
Modified:
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/CoercionTuple.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/CoercionTuple.java?rev=1087941&r1=1087940&r2=1087941&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/CoercionTuple.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/CoercionTuple.java
Sat Apr 2 00:34:34 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,7 +14,6 @@
package org.apache.tapestry5.ioc.services;
-
/**
* An immutable object that represents a mapping from one type to another.
This is also the contribution type when
* building the {@link org.apache.tapestry5.ioc.services.TypeCoercer} service.
Wraps a
@@ -107,13 +106,15 @@ public final class CoercionTuple<S, T>
* @param wrap
* if true, the coercion is wrapped to provide a useful
toString()
*/
+ @SuppressWarnings("unchecked")
public CoercionTuple(Class<S> sourceType, Class<T> targetType, Coercion<S,
T> coercion, boolean wrap)
{
assert sourceType != null;
assert targetType != null;
assert coercion != null;
- this.sourceType = sourceType;
- this.targetType = targetType;
+
+ this.sourceType = ClassFabUtils.getWrapperType(sourceType);
+ this.targetType = ClassFabUtils.getWrapperType(targetType);
this.coercion = wrap ? new CoercionWrapper<S, T>(coercion) : coercion;
}