summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/databinding-json/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-09-08 05:54:43 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-09-08 05:54:43 +0000
commita78cc2308b2f7f7c652b818e8e29de705db1c8cc (patch)
tree62ff4d31a7deb10fe5d3aa96aeb4733a1ecfea10 /sca-java-2.x/trunk/modules/databinding-json/src/main
parent1315e46609bf6beb0c275c59176c846c17b3c614 (diff)
Add support for primitive java types
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@993611 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/databinding-json/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/Object2JSON.java3
1 files changed, 3 insertions, 0 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 ffd73ffe82..f405d2b687 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
@@ -53,6 +53,9 @@ public class Object2JSON implements PullTransformer<Object, Object> {
targetType = String.class;
}
try {
+ if (targetType != null && targetType.isPrimitive()) {
+ return source;
+ }
String value = mapper.writeValueAsString(source);
if (targetType == String.class || targetType == Object.class || targetType.isPrimitive()) {
return value;