diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-01 03:58:49 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-01 03:58:49 +0000 |
commit | d7631af7383601b96eba9da4a4c90c43fa2a9a33 (patch) | |
tree | bacb2d911ebdb0a03a4823ef1a19dbfa6a075f25 /java/sca/modules | |
parent | f178ddb849ece0fe7142741686c4387b92041f3b (diff) |
Converting JSON Databinding implementation to 2.x
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820522 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
5 files changed, 11 insertions, 8 deletions
diff --git a/java/sca/modules/databinding-json/pom.xml b/java/sca/modules/databinding-json/pom.xml index 140691460b..41c3b6abbb 100644 --- a/java/sca/modules/databinding-json/pom.xml +++ b/java/sca/modules/databinding-json/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-modules</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>tuscany-databinding-json</artifactId> @@ -32,12 +32,12 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-core-spi</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-databinding</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> diff --git a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java index de023157bc..866b9ff6ec 100644 --- a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java +++ b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.Comparator; import org.apache.tuscany.sca.databinding.PullTransformer; +import org.apache.tuscany.sca.databinding.SimpleTypeMapper; import org.apache.tuscany.sca.databinding.TransformationContext; import org.apache.tuscany.sca.databinding.TransformationException; import org.apache.tuscany.sca.databinding.impl.BaseTransformer; @@ -39,6 +40,8 @@ import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; public class JavaBean2JSONObject extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> { + private static final SimpleTypeMapper SIMPLE_TYPE_MAPPER = new SimpleTypeMapperImpl(); + private static final Comparator<PropertyDescriptor> COMPARATOR = new Comparator<PropertyDescriptor>() { public int compare(PropertyDescriptor o1, PropertyDescriptor o2) { return o1.getName().compareTo(o2.getName()); @@ -52,7 +55,7 @@ public class JavaBean2JSONObject extends BaseTransformer<Object, Object> impleme if (o == null) { return null; } - TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass()); + TypeInfo info = SIMPLE_TYPE_MAPPER.getXMLType(o.getClass()); if (info != null) { return MAPPER.toXMLLiteral(info.getQName(), o, null); } else { @@ -61,7 +64,7 @@ public class JavaBean2JSONObject extends BaseTransformer<Object, Object> impleme } private static boolean isSimpleType(Class<?> javaType) { - return SimpleTypeMapperImpl.getXMLType(javaType) != null; + return SIMPLE_TYPE_MAPPER.getXMLType(javaType) != null; } public JavaBean2JSONObject() { diff --git a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java index aa75afc9d4..3e5562e431 100644 --- a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java +++ b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java @@ -24,11 +24,11 @@ import java.io.StringWriter; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.common.xml.stax.impl.XMLStreamSerializer; import org.apache.tuscany.sca.databinding.PullTransformer; import org.apache.tuscany.sca.databinding.TransformationContext; import org.apache.tuscany.sca.databinding.TransformationException; import org.apache.tuscany.sca.databinding.impl.BaseTransformer; -import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer; import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter; /** diff --git a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java index 1072b70029..fb02d27b05 100644 --- a/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java +++ b/java/sca/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java @@ -34,7 +34,7 @@ import org.apache.tuscany.sca.databinding.json.JSONHelper; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.util.XMLType; import org.codehaus.jettison.json.JSONObject; -import org.osoa.sca.annotations.Service; +import org.oasisopen.sca.annotation.Service; /** * @version $Rev$ $Date$ diff --git a/java/sca/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java b/java/sca/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java index 3c7f151ed7..14c5f83baf 100644 --- a/java/sca/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java +++ b/java/sca/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java @@ -32,10 +32,10 @@ import junit.framework.Assert; import junit.framework.TestCase; import org.apache.axiom.om.OMElement; +import org.apache.tuscany.sca.common.xml.stax.impl.XMLStreamSerializer; import org.apache.tuscany.sca.databinding.TransformationContext; import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl; import org.apache.tuscany.sca.databinding.json.axiom.JSON2OMElement; -import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; import org.apache.tuscany.sca.interfacedef.util.XMLType; |