diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/databinding-json/src')
-rw-r--r-- | sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/Object2JSON.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/Object2JSON.java b/sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/Object2JSON.java index f405d2b687..d543d0554a 100644 --- a/sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/Object2JSON.java +++ b/sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/Object2JSON.java @@ -19,6 +19,8 @@ package org.apache.tuscany.sca.databinding.json.jackson; +import java.math.BigDecimal; + import org.apache.tuscany.sca.databinding.PullTransformer; import org.apache.tuscany.sca.databinding.TransformationContext; import org.apache.tuscany.sca.databinding.TransformationException; @@ -57,8 +59,12 @@ public class Object2JSON implements PullTransformer<Object, Object> { return source; } String value = mapper.writeValueAsString(source); - if (targetType == String.class || targetType == Object.class || targetType.isPrimitive()) { + if (targetType == String.class || + targetType == Object.class || + targetType.isPrimitive()) { return value; + } else if (targetType == BigDecimal.class){ + return value.toString(); } else if (JsonNode.class.isAssignableFrom(targetType)) { return JacksonHelper.createJsonParser(value).readValueAsTree(); } |