diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-08 05:54:43 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-08 05:54:43 +0000 |
commit | a78cc2308b2f7f7c652b818e8e29de705db1c8cc (patch) | |
tree | 62ff4d31a7deb10fe5d3aa96aeb4733a1ecfea10 | |
parent | 1315e46609bf6beb0c275c59176c846c17b3c614 (diff) |
Add support for primitive java types
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@993611 13f79535-47bb-0310-9956-ffa450edef68
5 files changed, 14 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java index 66cf8f5b98..f4a2023b17 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java +++ b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldClient.java @@ -37,4 +37,8 @@ public class HelloWorldClient implements HelloWorldService { public BeanA sayHello3(BeanA bean) { return ref.sayHello3(bean); } + + public int sayHello4(boolean flag) { + return ref.sayHello4(flag); + } } diff --git a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java index 94b7c64dba..f73b185ead 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java +++ b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldImpl.java @@ -33,5 +33,9 @@ public class HelloWorldImpl implements HelloWorldService { bean.setS("XYZ"); return bean; } + + public int sayHello4(boolean flag) { + return 0; + } } diff --git a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java index a215ecf4be..790fdd7467 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java +++ b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/helloworld/HelloWorldService.java @@ -28,5 +28,7 @@ public interface HelloWorldService { String sayHello2(String firstName, String lastName); BeanA sayHello3(BeanA bean); + + int sayHello4(boolean flag); } diff --git a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java index 6923243d1a..27b8cec2f1 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/test/java/test/BindingTestCase.java @@ -66,6 +66,7 @@ public class BindingTestCase { Assert.assertEquals("Hello beate", client.sayHello("beate")); Assert.assertEquals("Hello beate arnold", client.sayHello2("beate", "arnold")); + Assert.assertEquals(0, client.sayHello4(true)); } @Test 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; |