You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/11/28 17:26:07 UTC
svn commit: r349421 - in
/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema:
typemap/JavaTypeMap.java util/ConverterUtil.java
Author: ajith
Date: Mon Nov 28 08:25:51 2005
New Revision: 349421
URL: http://svn.apache.org/viewcvs?rev=349421&view=rev
Log:
1. Added other simple types for the Java type map
2. Updated the converter util to include the necessary converter utilities for most of the simple types. There's still work to be done in this
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/typemap/JavaTypeMap.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/typemap/JavaTypeMap.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/typemap/JavaTypeMap.java?rev=349421&r1=349420&r2=349421&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/typemap/JavaTypeMap.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/typemap/JavaTypeMap.java Mon Nov 28 08:25:51 2005
@@ -25,6 +25,7 @@
/**
* The java type map. uses a static map for caching
+ * Most code from Axis 1 Codebase
*/
public class JavaTypeMap implements TypeMap {
@@ -59,6 +60,9 @@
// Mapping for xsd:time. Map to Axis type Time
addTypemapping(SchemaConstants.XSD_TIME, Time.class.getName());
+ addTypemapping(SchemaConstants.XSD_DATETIME, java.util.Calendar.class.getName());
+ addTypemapping(SchemaConstants.XSD_BASE64, "byte[]"); //todo need to be fixed!
+ addTypemapping(SchemaConstants.XSD_HEXBIN, HexBinary.class.getName());
// These are the g* types (gYearMonth, etc) which map to Axis types
addTypemapping(SchemaConstants.XSD_YEARMONTH, YearMonth.class.getName());
@@ -67,7 +71,7 @@
addTypemapping(SchemaConstants.XSD_DAY, Day.class.getName());
addTypemapping(SchemaConstants.XSD_MONTHDAY, MonthDay.class.getName());
-// xsd:token
+ // xsd:token
addTypemapping(SchemaConstants.XSD_TOKEN, Token.class.getName());
// a xsd:normalizedString
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java?rev=349421&r1=349420&r2=349421&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java Mon Nov 28 08:25:51 2005
@@ -1,6 +1,10 @@
package org.apache.axis2.databinding.schema.util;
+import org.apache.axis2.databinding.schema.SchemaConstants;
+import org.apache.axis2.databinding.schema.types.*;
+
import java.util.List;
+import java.util.Calendar;
import java.lang.reflect.Array;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -66,7 +70,16 @@
- /* String to primitive type conversions */
+ /* String to java type conversions
+ These methods have a special signature structure
+ <code>convertTo</code> followed by the schema type name
+ Say for int, convertToint(String) is the converter method
+
+ Not very elegant but it seems to be the only way!
+
+ */
+
+
public static int convertToint(String s){
return Integer.parseInt(s);
}
@@ -95,7 +108,118 @@
return Boolean.getBoolean(s);
}
- /* primitive types to Object conversion methods */
+ public static YearMonth convertTogYearMonth(String s){
+ return new YearMonth(s);
+ }
+
+ public static MonthDay convertTogMonthDay(String s){
+ return new MonthDay(s);
+ }
+
+ public static Year convertTogYear(String s){
+ return new Year(s);
+ }
+
+ public static Month convertTogMonth(String s){
+ return new Month(s);
+ }
+
+ public static Day convertTogDay(String s){
+ return new Day(s);
+ }
+
+ public static Duration convertToduration(String s){
+ return new Duration(s);
+ }
+
+
+ public static Token convertTotoken(String s){
+ return new Token(s);
+ }
+ public static NormalizedString convertTonormalizedString(String s){
+ return new NormalizedString(s);
+ }
+ public static UnsignedLong convertTounsignedLong(String s){
+ return new UnsignedLong(s);
+ }
+ public static UnsignedInt convertTounsignedInt(String s){
+ return new UnsignedInt(s);
+ }
+ public static UnsignedShort convertTounsignedShort(String s){
+ return new UnsignedShort(s);
+ }
+ public static UnsignedByte convertTounsignedByte(String s){
+ return new UnsignedByte(s);
+ }
+ public static NonNegativeInteger convertTononNegativeInteger(String s){
+ return new NonNegativeInteger(s);
+ }
+ public static NegativeInteger convertTonegativeInteger(String s){
+ return new NegativeInteger(s);
+ }
+ public static PositiveInteger convertTopositiveInteger(String s){
+ return new PositiveInteger(s);
+ }
+ public static NonPositiveInteger convertTononPositiveInteger(String s){
+ return new NonPositiveInteger(s);
+ }
+
+ public static Name convertToName(String s){
+ return new Name(s);
+ }
+ public static NCName convertToNCName(String s){
+ return new NCName(s);
+ }
+ public static Id convertToID(String s){
+ return new Id(s);
+ }
+ public static Language convertTolanguage(String s){
+ return new Language(s);
+ }
+ public static NMToken convertToNMTOKEN(String s){
+ return new NMToken(s);
+ }
+
+ public static NMTokens convertToNMTOKENS(String s){
+ return new NMTokens(s);
+ }
+
+ public static Notation convertToNOTATION(String s){
+ return null; //todo Need to fix this
+ // return new Notation(s);
+ }
+
+ public static Entity convertToENTITY(String s){
+ return new Entity(s);
+ }
+
+ public static Entities convertToENTITIES(String s){
+ return new Entities(s);
+ }
+
+ public static IDRef convertToIDREF(String s){
+ return new IDRef(s);
+ }
+ public static IDRefs convertToIDREFS(String s){
+ return new IDRefs(s);
+ }
+
+ public static URI convertToanyURI(String s) throws Exception{
+ return new URI(s);
+ }
+
+ public static int convertTointeger(String s) throws Exception{
+ return Integer.parseInt(s);
+ }
+
+ public static Calendar convertTodateTime(String s) throws Exception{ //need to fix this
+ return null;
+ }
+
+
+ /* ################################################################# */
+
+ /* java Primitive types to Object conversion methods */
public static Object convertToObject(String i){
return i;
}