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 di...@apache.org on 2006/01/06 05:26:57 UTC
svn commit: r366421 [1/3] - in /webservices/axis2/trunk/java/modules:
adb/src/org/apache/axis2/databinding/types/
adb/src/org/apache/axis2/databinding/utils/
codegen/src/org/apache/axis2/schema/
codegen/src/org/apache/axis2/schema/writer/ codegen/src/o...
Author: dims
Date: Thu Jan 5 20:26:39 2006
New Revision: 366421
URL: http://svn.apache.org/viewcvs?rev=366421&view=rev
Log:
trying to eliminate javadoc warnings
Modified:
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Id.java
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/NormalizedString.java
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/util/XSLTTemplateProcessor.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/util/XSLTUtils.java
webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/ProjectResourceBundle.java
webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/RB.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/HttpRequestHandlerChain.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/JMSConnector.java
webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/SOAPElement.java
webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java
webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java
webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/soap11/SOAP11FaultImpl.java
webservices/axis2/trunk/java/modules/doom/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/config/InflowConfiguration.java
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/token/IssueRequestSecurityToken.java
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/token/RequestSecurityToken.java
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Id.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Id.java?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Id.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Id.java Thu Jan 5 20:26:39 2006
@@ -1,72 +1,72 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.databinding.types;
-
-
-/**
- * Custom class for supporting XSD data type ID
- * The base type of Id is NCName.
- *
- * @see <a href="http://www.w3.org/TR/xmlschema-2/#ID">XML Schema 3.3.8</a>
- */
-public class Id extends NCName {
-
- private static final long serialVersionUID = -8442438083214211437L;
-
- public Id() {
- super();
- }
-
- /**
- * ctor for Id
- * @exception IllegalArgumentException will be thrown if validation fails
- */
- public Id(String stValue) throws IllegalArgumentException {
- try {
- setValue(stValue);
- }
- catch (IllegalArgumentException e) {
- // recast normalizedString exception as token exception
- throw new IllegalArgumentException();
- //Messages.getMessage("badIdType00") + "data=[" +
- //stValue + "]");
- }
- }
-
- /**
- *
- * validates the data and sets the value for the object.
- * @param Token String value
- * @throws IllegalArgumentException if invalid format
- */
- public void setValue(String stValue) throws IllegalArgumentException {
- if (!Id.isValid(stValue))
- throw new IllegalArgumentException(
- // Messages.getMessage("badIdType00") +
- " data=[" + stValue + "]");
- m_value = stValue;
- }
-
- /**
- *
- * validate the value against the xsd definition
- *
- * Same validation as NCName for the time being
- */
- public static boolean isValid(String stValue) {
- return NCName.isValid(stValue);
- }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.databinding.types;
+
+
+/**
+ * Custom class for supporting XSD data type ID
+ * The base type of Id is NCName.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#ID">XML Schema 3.3.8</a>
+ */
+public class Id extends NCName {
+
+ private static final long serialVersionUID = -8442438083214211437L;
+
+ public Id() {
+ super();
+ }
+
+ /**
+ * Constructor for Id.
+ * @exception IllegalArgumentException will be thrown if validation fails
+ */
+ public Id(String stValue) throws IllegalArgumentException {
+ try {
+ setValue(stValue);
+ }
+ catch (IllegalArgumentException e) {
+ // recast normalizedString exception as token exception
+ throw new IllegalArgumentException();
+ //Messages.getMessage("badIdType00") + "data=[" +
+ //stValue + "]");
+ }
+ }
+
+ /**
+ *
+ * Validates the data and sets the value for the object.
+ * @param stValue String value
+ * @throws IllegalArgumentException if invalid format
+ */
+ public void setValue(String stValue) throws IllegalArgumentException {
+ if (!Id.isValid(stValue))
+ throw new IllegalArgumentException(
+ // Messages.getMessage("badIdType00") +
+ " data=[" + stValue + "]");
+ m_value = stValue;
+ }
+
+ /**
+ *
+ * Validates the value against the xsd definition.
+ *
+ * Same validation as NCName for the time being
+ */
+ public static boolean isValid(String stValue) {
+ return NCName.isValid(stValue);
+ }
+}
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/NormalizedString.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/NormalizedString.java?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/NormalizedString.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/NormalizedString.java Thu Jan 5 20:26:39 2006
@@ -1,102 +1,102 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.databinding.types;
-
-
-/**
- * Custom class for supporting XSD data type NormalizedString.
- * normalizedString represents white space normalized strings.
- * The base type of normalizedString is string.
- *
- * @see <a href="http://www.w3.org/TR/xmlschema-2/#normalizedString">XML Schema Part 2: Datatypes 3.3.1</a>
- */
-public class NormalizedString implements java.io.Serializable {
-
- private static final long serialVersionUID = -290878151870399401L;
-
- String m_value; // JAX-RPC maps xsd:string to java.lang.String
-
- public NormalizedString() {
- super();
- }
-
- /**
- *
- * ctor for NormalizedString
- * @param stValue is the String value
- * @throws IllegalArgumentException if invalid format
- */
- public NormalizedString(String stValue) throws IllegalArgumentException {
- setValue(stValue);
- }
-
- /**
- *
- * validates the data and sets the value for the object.
- * @param stValue String value
- * @throws IllegalArgumentException if invalid format
- */
- public void setValue(String stValue) throws IllegalArgumentException {
- if (!NormalizedString.isValid(stValue))
- throw new IllegalArgumentException(
-// Messages.getMessage("badNormalizedString00") +
- " data=[" + stValue + "]");
- m_value = stValue;
- }
-
- public String toString(){
- return m_value;
- }
-
- public int hashCode(){
- return m_value.hashCode();
- }
-
- /**
- *
- * validate the value against the xsd definition for the object
- *
- * The value space of normalizedString is the set of strings that
- * do not contain the carriage return (#xD), line feed (#xA) nor
- * tab (#x9) characters. The lexical space of normalizedString is
- * the set of strings that do not contain the carriage return (#xD)
- * nor tab (#x9) characters.
- *
- * @param stValue the String to test
- * @returns true if valid normalizedString
- */
- public static boolean isValid(String stValue) {
- int scan;
-
- for (scan = 0; scan < stValue.length(); scan++) {
- char cDigit = stValue.charAt(scan);
- switch (cDigit) {
- case 0x09:
- case 0x0A:
- case 0x0D:
- return false;
- default:
- break;
- }
- }
- return true;
- }
-
- public boolean equals(Object object) {
- String s1 = object.toString();
- return s1.equals(m_value);
- }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.databinding.types;
+
+
+/**
+ * Custom class for supporting XSD data type NormalizedString.
+ * normalizedString represents white space normalized strings.
+ * The base type of normalizedString is string.
+ *
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#normalizedString">XML Schema Part 2: Datatypes 3.3.1</a>
+ */
+public class NormalizedString implements java.io.Serializable {
+
+ private static final long serialVersionUID = -290878151870399401L;
+
+ String m_value; // JAX-RPC maps xsd:string to java.lang.String
+
+ public NormalizedString() {
+ super();
+ }
+
+ /**
+ *
+ * ctor for NormalizedString
+ * @param stValue is the String value
+ * @throws IllegalArgumentException if invalid format
+ */
+ public NormalizedString(String stValue) throws IllegalArgumentException {
+ setValue(stValue);
+ }
+
+ /**
+ *
+ * validates the data and sets the value for the object.
+ * @param stValue String value
+ * @throws IllegalArgumentException if invalid format
+ */
+ public void setValue(String stValue) throws IllegalArgumentException {
+ if (!NormalizedString.isValid(stValue))
+ throw new IllegalArgumentException(
+// Messages.getMessage("badNormalizedString00") +
+ " data=[" + stValue + "]");
+ m_value = stValue;
+ }
+
+ public String toString(){
+ return m_value;
+ }
+
+ public int hashCode(){
+ return m_value.hashCode();
+ }
+
+ /**
+ *
+ * validate the value against the xsd definition for the object
+ *
+ * The value space of normalizedString is the set of strings that
+ * do not contain the carriage return (#xD), line feed (#xA) nor
+ * tab (#x9) characters. The lexical space of normalizedString is
+ * the set of strings that do not contain the carriage return (#xD)
+ * nor tab (#x9) characters.
+ *
+ * @param stValue the String to test
+ * @return Returns true if valid normalizedString.
+ */
+ public static boolean isValid(String stValue) {
+ int scan;
+
+ for (scan = 0; scan < stValue.length(); scan++) {
+ char cDigit = stValue.charAt(scan);
+ switch (cDigit) {
+ case 0x09:
+ case 0x0A:
+ case 0x0D:
+ return false;
+ default:
+ break;
+ }
+ }
+ return true;
+ }
+
+ public boolean equals(Object object) {
+ String s1 = object.toString();
+ return s1.equals(m_value);
+ }
+}
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java Thu Jan 5 20:26:39 2006
@@ -1,638 +1,638 @@
-package org.apache.axis2.databinding.utils;
-
-import org.apache.axis2.databinding.types.Day;
-import org.apache.axis2.databinding.types.Duration;
-import org.apache.axis2.databinding.types.Entities;
-import org.apache.axis2.databinding.types.Entity;
-import org.apache.axis2.databinding.types.HexBinary;
-import org.apache.axis2.databinding.types.IDRef;
-import org.apache.axis2.databinding.types.IDRefs;
-import org.apache.axis2.databinding.types.Id;
-import org.apache.axis2.databinding.types.Language;
-import org.apache.axis2.databinding.types.Month;
-import org.apache.axis2.databinding.types.MonthDay;
-import org.apache.axis2.databinding.types.NCName;
-import org.apache.axis2.databinding.types.NMToken;
-import org.apache.axis2.databinding.types.NMTokens;
-import org.apache.axis2.databinding.types.Name;
-import org.apache.axis2.databinding.types.NegativeInteger;
-import org.apache.axis2.databinding.types.NonNegativeInteger;
-import org.apache.axis2.databinding.types.NonPositiveInteger;
-import org.apache.axis2.databinding.types.NormalizedString;
-import org.apache.axis2.databinding.types.Notation;
-import org.apache.axis2.databinding.types.PositiveInteger;
-import org.apache.axis2.databinding.types.Time;
-import org.apache.axis2.databinding.types.Token;
-import org.apache.axis2.databinding.types.URI;
-import org.apache.axis2.databinding.types.UnsignedByte;
-import org.apache.axis2.databinding.types.UnsignedInt;
-import org.apache.axis2.databinding.types.UnsignedLong;
-import org.apache.axis2.databinding.types.UnsignedShort;
-import org.apache.axis2.databinding.types.Year;
-import org.apache.axis2.databinding.types.YearMonth;
-import sun.misc.BASE64Decoder;
-
-import javax.xml.namespace.QName;
-import java.lang.reflect.Array;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.TimeZone;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Converter methods to go from
- * 1. simple type -> String
- * 2. simple type -> Object
- * 3. String -> simpletype
- * 4. Object list -> array
- */
-public class ConverterUtil {
-
- /* String conversion methods */
- public static String convertToString(int i) {
- return i + "";
- }
-
- public static String convertToString(float i) {
- return i + "";
- }
-
- public static String convertToString(long i) {
- return i + "";
- }
-
- public static String convertToString(double i) {
- return i + "";
- }
-
- public static String convertToString(byte i) {
- return new String(new byte[]{i});
- }
-
- public static String convertToString(char i) {
- return new String(new char[]{i});
- }
-
- public static String convertToString(short i) {
- return i + "";
- }
-
- public static String convertToString(boolean i) {
- return i + "";
- }
-
- public static String convertToString(Date value) {
- Calendar calendar = Calendar.getInstance();
- SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
- StringBuffer buf = new StringBuffer();
- synchronized (calendar) {
- if (calendar.get(Calendar.ERA) == GregorianCalendar.BC) {
- buf.append("-");
- calendar.setTime((Date)value);
- calendar.set(Calendar.ERA, GregorianCalendar.AD);
- value = calendar.getTime();
- }
- buf.append(zulu.format(value));
- }
- return buf.toString();
- }
-
- public static String convertToString(Calendar value) {
- SimpleDateFormat zulu =
- new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- Date date = value.getTime();
-
- // Serialize including convert to GMT
- synchronized (zulu) {
- // Sun JDK bug http://developer.java.sun.com/developer/bugParade/bugs/4229798.html
- return zulu.format(date);
- }
- }
-
- public static String convertToString(Day o) {
- return o.toString();
- }
-
- public static String convertToString(YearMonth o) {
- return o.toString();
- }
-
- public static String convertToString(Year o) {
- return o.toString();
- }
-
- public static String convertToString(HexBinary o) {
- return o.toString();
- }
-
- public static String convertToString(MonthDay o) {
- return o.toString();
- }
-
- public static String convertToString(Time o) {
- return o.toString();
- }
- public static String convertToString(Byte o) {
- return o.toString();
- }
-
- public static String convertToString(BigInteger o) {
- return o.toString();
- }
- public static String convertToString(Integer o) {
- return o.toString();
- }
-
- public static String convertToString(Long o) {
- return o.toString();
- }
-
- public static String convertToString(Short o) {
- return o.toString();
- }
-
- public static String convertToString(UnsignedByte o) {
- return o.toString();
- }
-
- public static String convertToString(UnsignedInt o) {
- return o.toString();
- }
-
- public static String convertToString(UnsignedLong o) {
- return o.toString();
- }
-
- public static String convertToString(Object o) {
- return o.toString();
- }
-
- public static String convertToString(Double o) {
- return o.toString();
- }
-
- public static String convertToString(Duration o) {
- return o.toString();
- }
-
- public static String convertToString(Float o) {
- return o.toString();
- }
-
- public static String convertToString(Month o) {
- return o.toString();
- }
- /* ################################################################################ */
- /* 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);
- }
-
- public static double convertTodouble(String s) {
- return Double.parseDouble(s);
- }
-
- public static BigDecimal convertTodecimal(String s) {
- return new BigDecimal(s);
- }
-
- public static float convertTofloat(String s) {
- return Float.parseFloat(s);
- }
-
- public static String convertTostring(String s) {
- return s;
- }
-
- public static long convertTolong(String s) {
- return Long.parseLong(s);
- }
-
- public static short convertToshort(String s) {
- return Short.parseShort(s);
- }
-
- public static boolean convertToboolean(String s) {
- return Boolean.valueOf(s).booleanValue();
- }
-
- public static Object convertToanyType(String s) {
- return s; //todo -> What to do here?
- }
-
- 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 HexBinary convertTohexBinary(String s) {
- return new HexBinary(s);
- }
-
- public static byte[] convertTobase64Binary(String s) throws Exception{
- //using the Sun's base64 decoder that should come with the JRE
- return new BASE64Decoder().decodeBuffer(s);
- }
-
- /**
- * Convert a given string into a date
- * Code from Axis1 DateDeserializer
- *
- * @param s
- * @return
- */
- public static Date convertTodate(String source) {
-
- Calendar calendar = Calendar.getInstance();
- SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
- // 0123456789 0 123456789
- Date result;
- boolean bc = false;
-
- // validate fixed portion of format
- if (source != null) {
- if (source.charAt(0) == '+')
- source = source.substring(1);
-
- if (source.charAt(0) == '-') {
- source = source.substring(1);
- bc = true;
- }
-
- if (source.length() < 10)
- throw new NumberFormatException("bad date format");
-
-
- if (source.charAt(4) != '-' || source.charAt(7) != '-')
- throw new NumberFormatException("bad Date format");
-
- }
-
- synchronized (calendar) {
- // convert what we have validated so far
- try {
- result = zulu.parse(source == null ? null :
- (source.substring(0, 10)));
- } catch (Exception e) {
- throw new NumberFormatException(e.toString());
- }
-
- // support dates before the Christian era
- if (bc) {
- calendar.setTime(result);
- calendar.set(Calendar.ERA, GregorianCalendar.BC);
- result = calendar.getTime();
- }
- }
- return result;
- }
-
- public static Time convertTotime(String s) {
- return new Time(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 BigInteger convertTointeger(String s) throws Exception {
- return new BigInteger(s);
- }
-
- public static byte convertTobyte(String s) throws Exception {
- return Byte.parseByte(s);
- }
-
- /**
- * Code from Axis1 code base
- * Note - We only follow the convention in the latest schema spec
- * @param s
- * @return
- * @throws Exception
- */
- public static Calendar convertTodateTime(String source) throws Exception {
- Calendar calendar = Calendar.getInstance();
- SimpleDateFormat zulu =
- new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- Date date;
- boolean bc = false;
-
- // validate fixed portion of format
- if (source == null || source.length() == 0) {
- throw new NumberFormatException();
-// Messages.getMessage("badDateTime00"));
- }
- if (source.charAt(0) == '+') {
- source = source.substring(1);
- }
- if (source.charAt(0) == '-') {
- source = source.substring(1);
- bc = true;
- }
- if (source.length() < 19) {
- throw new NumberFormatException();
-// Messages.getMessage("badDateTime00"));
- }
- if (source.charAt(4) != '-' || source.charAt(7) != '-' ||
- source.charAt(10) != 'T') {
- throw new NumberFormatException();//Messages.getMessage("badDate00"));
- }
- if (source.charAt(13) != ':' || source.charAt(16) != ':') {
- throw new NumberFormatException();//Messages.getMessage("badTime00"));
- }
- // convert what we have validated so far
- try {
- synchronized (zulu) {
- date = zulu.parse(source.substring(0, 19) + ".000Z");
- }
- } catch (Exception e) {
- throw new NumberFormatException(e.toString());
- }
- int pos = 19;
-
- // parse optional milliseconds
- if (pos < source.length() && source.charAt(pos) == '.') {
- int milliseconds = 0;
- int start = ++pos;
- while (pos < source.length() &&
- Character.isDigit(source.charAt(pos))) {
- pos++;
- }
- String decimal = source.substring(start, pos);
- if (decimal.length() == 3) {
- milliseconds = Integer.parseInt(decimal);
- } else if (decimal.length() < 3) {
- milliseconds = Integer.parseInt((decimal + "000")
- .substring(0, 3));
- } else {
- milliseconds = Integer.parseInt(decimal.substring(0, 3));
- if (decimal.charAt(3) >= '5') {
- ++milliseconds;
- }
- }
-
- // add milliseconds to the current date
- date.setTime(date.getTime() + milliseconds);
- }
-
- // parse optional timezone
- if (pos + 5 < source.length() &&
- (source.charAt(pos) == '+' || (source.charAt(pos) == '-'))) {
- if (!Character.isDigit(source.charAt(pos + 1)) ||
- !Character.isDigit(source.charAt(pos + 2)) ||
- source.charAt(pos + 3) != ':' ||
- !Character.isDigit(source.charAt(pos + 4)) ||
- !Character.isDigit(source.charAt(pos + 5))) {
- throw new NumberFormatException();
- // Messages.getMessage("badTimezone00"));
- }
- int hours = (source.charAt(pos + 1) - '0') * 10
- + source.charAt(pos + 2) - '0';
- int mins = (source.charAt(pos + 4) - '0') * 10
- + source.charAt(pos + 5) - '0';
- int milliseconds = (hours * 60 + mins) * 60 * 1000;
-
- // subtract milliseconds from current date to obtain GMT
- if (source.charAt(pos) == '+') {
- milliseconds = -milliseconds;
- }
- date.setTime(date.getTime() + milliseconds);
- pos += 6;
- }
- if (pos < source.length() && source.charAt(pos) == 'Z') {
- pos++;
- calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
- }
- if (pos < source.length()) {
- throw new NumberFormatException();//Messages.getMessage("badChars00"));
- }
- calendar.setTime(date);
-
- // support dates before the Christian era
- if (bc) {
- calendar.set(Calendar.ERA, GregorianCalendar.BC);
- }
- return calendar;
-
- }
-
- /**
- * Code from Axis1 code base
- * @param source
- * @return
- */
- public static QName convertToQName(String source) {
- source = source.trim();
- int colon = source.lastIndexOf(":");
- String namespace = colon < 0 ? "" : "" ;// todo Fix this. Need to take a namespace with this
- //context.getNamespaceURI(source.substring(0, colon));
- String localPart = colon < 0 ? source : source.substring(colon + 1);
- return new QName(namespace, localPart);
- }
-
-
- /* ################################################################# */
-
- /* java Primitive types to Object conversion methods */
- public static Object convertToObject(String i) {
- return i;
- }
-
- public static Object convertToObject(boolean i) {
- return Boolean.valueOf(i);
- }
-
- public static Object convertToObject(double i) {
- return new Double(i);
- }
-
- public static Object convertToObject(byte i) {
- return new Byte(i);
- }
-
- public static Object convertToObject(char i) {
- return new Character(i);
- }
-
- public static Object convertToObject(short i) {
- return new Short(i);
- }
-
- /* list to array conversion methods */
-
- /**
- * @param baseArrayClass
- * @param objectList -> for primitive type array conversion we assume the content to be
- * strings!
- * @return
- */
- public static Object convertToArray(Class baseArrayClass, List objectList) {
- int listSize = objectList.size();
- Object returnArray = Array.newInstance(baseArrayClass, listSize);
- if (int.class.equals(baseArrayClass)) {
- for (int i = 0; i < listSize; i++) {
- Array.setInt(returnArray, i, Integer.parseInt(objectList.get(i).toString()));
- }
- } else if (float.class.equals(baseArrayClass)) {
- for (int i = 0; i < listSize; i++) {
- Array.setFloat(returnArray, i, Float.parseFloat(objectList.get(i).toString()));
- }
- } else if (short.class.equals(baseArrayClass)) {
- for (int i = 0; i < listSize; i++) {
- Array.setShort(returnArray, i, Short.parseShort(objectList.get(i).toString()));
- }
- } else if (long.class.equals(baseArrayClass)) {
- for (int i = 0; i < listSize; i++) {
- Array.setLong(returnArray, i, Long.parseLong(objectList.get(i).toString()));
- }
- } else if (boolean.class.equals(baseArrayClass)) {
- for (int i = 0; i < listSize; i++) {
- Array.setBoolean(returnArray, i, Boolean.getBoolean(objectList.get(i).toString()));
- }
- } else if (char.class.equals(baseArrayClass)) {
- for (int i = 0; i < listSize; i++) {
- Array.setChar(returnArray, i, objectList.get(i).toString().toCharArray()[0]);
- }
- } else if (double.class.equals(baseArrayClass)) {
- for (int i = 0; i < listSize; i++) {
- Array.setDouble(returnArray, i, Double.parseDouble(objectList.get(i).toString()));
- }
- } else {
- objectList.toArray((Object[])returnArray);
- }
- return returnArray;
- }
-
-}
+package org.apache.axis2.databinding.utils;
+
+import org.apache.axis2.databinding.types.Day;
+import org.apache.axis2.databinding.types.Duration;
+import org.apache.axis2.databinding.types.Entities;
+import org.apache.axis2.databinding.types.Entity;
+import org.apache.axis2.databinding.types.HexBinary;
+import org.apache.axis2.databinding.types.IDRef;
+import org.apache.axis2.databinding.types.IDRefs;
+import org.apache.axis2.databinding.types.Id;
+import org.apache.axis2.databinding.types.Language;
+import org.apache.axis2.databinding.types.Month;
+import org.apache.axis2.databinding.types.MonthDay;
+import org.apache.axis2.databinding.types.NCName;
+import org.apache.axis2.databinding.types.NMToken;
+import org.apache.axis2.databinding.types.NMTokens;
+import org.apache.axis2.databinding.types.Name;
+import org.apache.axis2.databinding.types.NegativeInteger;
+import org.apache.axis2.databinding.types.NonNegativeInteger;
+import org.apache.axis2.databinding.types.NonPositiveInteger;
+import org.apache.axis2.databinding.types.NormalizedString;
+import org.apache.axis2.databinding.types.Notation;
+import org.apache.axis2.databinding.types.PositiveInteger;
+import org.apache.axis2.databinding.types.Time;
+import org.apache.axis2.databinding.types.Token;
+import org.apache.axis2.databinding.types.URI;
+import org.apache.axis2.databinding.types.UnsignedByte;
+import org.apache.axis2.databinding.types.UnsignedInt;
+import org.apache.axis2.databinding.types.UnsignedLong;
+import org.apache.axis2.databinding.types.UnsignedShort;
+import org.apache.axis2.databinding.types.Year;
+import org.apache.axis2.databinding.types.YearMonth;
+import sun.misc.BASE64Decoder;
+
+import javax.xml.namespace.QName;
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.TimeZone;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Converter methods to go from
+ * 1. simple type -> String
+ * 2. simple type -> Object
+ * 3. String -> simpletype
+ * 4. Object list -> array
+ */
+public class ConverterUtil {
+
+ /* String conversion methods */
+ public static String convertToString(int i) {
+ return i + "";
+ }
+
+ public static String convertToString(float i) {
+ return i + "";
+ }
+
+ public static String convertToString(long i) {
+ return i + "";
+ }
+
+ public static String convertToString(double i) {
+ return i + "";
+ }
+
+ public static String convertToString(byte i) {
+ return new String(new byte[]{i});
+ }
+
+ public static String convertToString(char i) {
+ return new String(new char[]{i});
+ }
+
+ public static String convertToString(short i) {
+ return i + "";
+ }
+
+ public static String convertToString(boolean i) {
+ return i + "";
+ }
+
+ public static String convertToString(Date value) {
+ Calendar calendar = Calendar.getInstance();
+ SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
+ StringBuffer buf = new StringBuffer();
+ synchronized (calendar) {
+ if (calendar.get(Calendar.ERA) == GregorianCalendar.BC) {
+ buf.append("-");
+ calendar.setTime((Date)value);
+ calendar.set(Calendar.ERA, GregorianCalendar.AD);
+ value = calendar.getTime();
+ }
+ buf.append(zulu.format(value));
+ }
+ return buf.toString();
+ }
+
+ public static String convertToString(Calendar value) {
+ SimpleDateFormat zulu =
+ new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ Date date = value.getTime();
+
+ // Serialize including convert to GMT
+ synchronized (zulu) {
+ // Sun JDK bug http://developer.java.sun.com/developer/bugParade/bugs/4229798.html
+ return zulu.format(date);
+ }
+ }
+
+ public static String convertToString(Day o) {
+ return o.toString();
+ }
+
+ public static String convertToString(YearMonth o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Year o) {
+ return o.toString();
+ }
+
+ public static String convertToString(HexBinary o) {
+ return o.toString();
+ }
+
+ public static String convertToString(MonthDay o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Time o) {
+ return o.toString();
+ }
+ public static String convertToString(Byte o) {
+ return o.toString();
+ }
+
+ public static String convertToString(BigInteger o) {
+ return o.toString();
+ }
+ public static String convertToString(Integer o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Long o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Short o) {
+ return o.toString();
+ }
+
+ public static String convertToString(UnsignedByte o) {
+ return o.toString();
+ }
+
+ public static String convertToString(UnsignedInt o) {
+ return o.toString();
+ }
+
+ public static String convertToString(UnsignedLong o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Object o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Double o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Duration o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Float o) {
+ return o.toString();
+ }
+
+ public static String convertToString(Month o) {
+ return o.toString();
+ }
+ /* ################################################################################ */
+ /* 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);
+ }
+
+ public static double convertTodouble(String s) {
+ return Double.parseDouble(s);
+ }
+
+ public static BigDecimal convertTodecimal(String s) {
+ return new BigDecimal(s);
+ }
+
+ public static float convertTofloat(String s) {
+ return Float.parseFloat(s);
+ }
+
+ public static String convertTostring(String s) {
+ return s;
+ }
+
+ public static long convertTolong(String s) {
+ return Long.parseLong(s);
+ }
+
+ public static short convertToshort(String s) {
+ return Short.parseShort(s);
+ }
+
+ public static boolean convertToboolean(String s) {
+ return Boolean.valueOf(s).booleanValue();
+ }
+
+ public static Object convertToanyType(String s) {
+ return s; //todo -> What to do here?
+ }
+
+ 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 HexBinary convertTohexBinary(String s) {
+ return new HexBinary(s);
+ }
+
+ public static byte[] convertTobase64Binary(String s) throws Exception{
+ //using the Sun's base64 decoder that should come with the JRE
+ return new BASE64Decoder().decodeBuffer(s);
+ }
+
+ /**
+ * Converts a given string into a date.
+ * Code from Axis1 DateDeserializer.
+ *
+ * @param s
+ * @return Returns Date.
+ */
+ public static Date convertTodate(String source) {
+
+ Calendar calendar = Calendar.getInstance();
+ SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
+ // 0123456789 0 123456789
+ Date result;
+ boolean bc = false;
+
+ // validate fixed portion of format
+ if (source != null) {
+ if (source.charAt(0) == '+')
+ source = source.substring(1);
+
+ if (source.charAt(0) == '-') {
+ source = source.substring(1);
+ bc = true;
+ }
+
+ if (source.length() < 10)
+ throw new NumberFormatException("bad date format");
+
+
+ if (source.charAt(4) != '-' || source.charAt(7) != '-')
+ throw new NumberFormatException("bad Date format");
+
+ }
+
+ synchronized (calendar) {
+ // convert what we have validated so far
+ try {
+ result = zulu.parse(source == null ? null :
+ (source.substring(0, 10)));
+ } catch (Exception e) {
+ throw new NumberFormatException(e.toString());
+ }
+
+ // support dates before the Christian era
+ if (bc) {
+ calendar.setTime(result);
+ calendar.set(Calendar.ERA, GregorianCalendar.BC);
+ result = calendar.getTime();
+ }
+ }
+ return result;
+ }
+
+ public static Time convertTotime(String s) {
+ return new Time(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 BigInteger convertTointeger(String s) throws Exception {
+ return new BigInteger(s);
+ }
+
+ public static byte convertTobyte(String s) throws Exception {
+ return Byte.parseByte(s);
+ }
+
+ /**
+ * Code from Axis1 code base
+ * Note - We only follow the convention in the latest schema spec
+ * @param s
+ * @return Returns Calendar.
+ * @throws Exception
+ */
+ public static Calendar convertTodateTime(String source) throws Exception {
+ Calendar calendar = Calendar.getInstance();
+ SimpleDateFormat zulu =
+ new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ Date date;
+ boolean bc = false;
+
+ // validate fixed portion of format
+ if (source == null || source.length() == 0) {
+ throw new NumberFormatException();
+// Messages.getMessage("badDateTime00"));
+ }
+ if (source.charAt(0) == '+') {
+ source = source.substring(1);
+ }
+ if (source.charAt(0) == '-') {
+ source = source.substring(1);
+ bc = true;
+ }
+ if (source.length() < 19) {
+ throw new NumberFormatException();
+// Messages.getMessage("badDateTime00"));
+ }
+ if (source.charAt(4) != '-' || source.charAt(7) != '-' ||
+ source.charAt(10) != 'T') {
+ throw new NumberFormatException();//Messages.getMessage("badDate00"));
+ }
+ if (source.charAt(13) != ':' || source.charAt(16) != ':') {
+ throw new NumberFormatException();//Messages.getMessage("badTime00"));
+ }
+ // convert what we have validated so far
+ try {
+ synchronized (zulu) {
+ date = zulu.parse(source.substring(0, 19) + ".000Z");
+ }
+ } catch (Exception e) {
+ throw new NumberFormatException(e.toString());
+ }
+ int pos = 19;
+
+ // parse optional milliseconds
+ if (pos < source.length() && source.charAt(pos) == '.') {
+ int milliseconds = 0;
+ int start = ++pos;
+ while (pos < source.length() &&
+ Character.isDigit(source.charAt(pos))) {
+ pos++;
+ }
+ String decimal = source.substring(start, pos);
+ if (decimal.length() == 3) {
+ milliseconds = Integer.parseInt(decimal);
+ } else if (decimal.length() < 3) {
+ milliseconds = Integer.parseInt((decimal + "000")
+ .substring(0, 3));
+ } else {
+ milliseconds = Integer.parseInt(decimal.substring(0, 3));
+ if (decimal.charAt(3) >= '5') {
+ ++milliseconds;
+ }
+ }
+
+ // add milliseconds to the current date
+ date.setTime(date.getTime() + milliseconds);
+ }
+
+ // parse optional timezone
+ if (pos + 5 < source.length() &&
+ (source.charAt(pos) == '+' || (source.charAt(pos) == '-'))) {
+ if (!Character.isDigit(source.charAt(pos + 1)) ||
+ !Character.isDigit(source.charAt(pos + 2)) ||
+ source.charAt(pos + 3) != ':' ||
+ !Character.isDigit(source.charAt(pos + 4)) ||
+ !Character.isDigit(source.charAt(pos + 5))) {
+ throw new NumberFormatException();
+ // Messages.getMessage("badTimezone00"));
+ }
+ int hours = (source.charAt(pos + 1) - '0') * 10
+ + source.charAt(pos + 2) - '0';
+ int mins = (source.charAt(pos + 4) - '0') * 10
+ + source.charAt(pos + 5) - '0';
+ int milliseconds = (hours * 60 + mins) * 60 * 1000;
+
+ // subtract milliseconds from current date to obtain GMT
+ if (source.charAt(pos) == '+') {
+ milliseconds = -milliseconds;
+ }
+ date.setTime(date.getTime() + milliseconds);
+ pos += 6;
+ }
+ if (pos < source.length() && source.charAt(pos) == 'Z') {
+ pos++;
+ calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
+ }
+ if (pos < source.length()) {
+ throw new NumberFormatException();//Messages.getMessage("badChars00"));
+ }
+ calendar.setTime(date);
+
+ // support dates before the Christian era
+ if (bc) {
+ calendar.set(Calendar.ERA, GregorianCalendar.BC);
+ }
+ return calendar;
+
+ }
+
+ /**
+ * Code from Axis1 code base
+ * @param source
+ * @return Returns QName.
+ */
+ public static QName convertToQName(String source) {
+ source = source.trim();
+ int colon = source.lastIndexOf(":");
+ String namespace = colon < 0 ? "" : "" ;// todo Fix this. Need to take a namespace with this
+ //context.getNamespaceURI(source.substring(0, colon));
+ String localPart = colon < 0 ? source : source.substring(colon + 1);
+ return new QName(namespace, localPart);
+ }
+
+
+ /* ################################################################# */
+
+ /* java Primitive types to Object conversion methods */
+ public static Object convertToObject(String i) {
+ return i;
+ }
+
+ public static Object convertToObject(boolean i) {
+ return Boolean.valueOf(i);
+ }
+
+ public static Object convertToObject(double i) {
+ return new Double(i);
+ }
+
+ public static Object convertToObject(byte i) {
+ return new Byte(i);
+ }
+
+ public static Object convertToObject(char i) {
+ return new Character(i);
+ }
+
+ public static Object convertToObject(short i) {
+ return new Short(i);
+ }
+
+ /* list to array conversion methods */
+
+ /**
+ * @param baseArrayClass
+ * @param objectList -> for primitive type array conversion we assume the content to be
+ * strings!
+ * @return Returns Object.
+ */
+ public static Object convertToArray(Class baseArrayClass, List objectList) {
+ int listSize = objectList.size();
+ Object returnArray = Array.newInstance(baseArrayClass, listSize);
+ if (int.class.equals(baseArrayClass)) {
+ for (int i = 0; i < listSize; i++) {
+ Array.setInt(returnArray, i, Integer.parseInt(objectList.get(i).toString()));
+ }
+ } else if (float.class.equals(baseArrayClass)) {
+ for (int i = 0; i < listSize; i++) {
+ Array.setFloat(returnArray, i, Float.parseFloat(objectList.get(i).toString()));
+ }
+ } else if (short.class.equals(baseArrayClass)) {
+ for (int i = 0; i < listSize; i++) {
+ Array.setShort(returnArray, i, Short.parseShort(objectList.get(i).toString()));
+ }
+ } else if (long.class.equals(baseArrayClass)) {
+ for (int i = 0; i < listSize; i++) {
+ Array.setLong(returnArray, i, Long.parseLong(objectList.get(i).toString()));
+ }
+ } else if (boolean.class.equals(baseArrayClass)) {
+ for (int i = 0; i < listSize; i++) {
+ Array.setBoolean(returnArray, i, Boolean.getBoolean(objectList.get(i).toString()));
+ }
+ } else if (char.class.equals(baseArrayClass)) {
+ for (int i = 0; i < listSize; i++) {
+ Array.setChar(returnArray, i, objectList.get(i).toString().toCharArray()[0]);
+ }
+ } else if (double.class.equals(baseArrayClass)) {
+ for (int i = 0; i < listSize; i++) {
+ Array.setDouble(returnArray, i, Double.parseDouble(objectList.get(i).toString()));
+ }
+ } else {
+ objectList.toArray((Object[])returnArray);
+ }
+ return returnArray;
+ }
+
+}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java Thu Jan 5 20:26:39 2006
@@ -1,317 +1,316 @@
-package org.apache.axis2.schema;
-
-import javax.xml.namespace.QName;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * This is a class used as a holder to pass on the meta information to the bean writer
- * This meta information will be used by the writer to write the databinding conversion code
- * Note - Metainfholders are not meant to be reused!!!. They are per-class basis and are strictly
- * not thread safe!!!!
- */
-public class BeanWriterMetaInfoHolder {
-
-
- private boolean ordered = false;
- private boolean anonymous = false;
- private boolean extension = false;
- private String extensionClassName = "";
- private Map elementToSchemaQNameMap = new HashMap();
- private Map elementToJavaClassMap = new HashMap();
- private Map specialTypeFlagMap = new HashMap();
- private Map qNameMaxOccursCountMap = new HashMap();
- private Map qNameMinOccursCountMap = new HashMap();
- private Map qNameOrderMap = new HashMap();
-
- /**
- * get the anon status
- *
- * @return
- */
- public boolean isAnonymous() {
- return anonymous;
- }
-
- /**
- * Set the anonymous flag
- *
- * @param anonymous
- */
- public void setAnonymous(boolean anonymous) {
- this.anonymous = anonymous;
- }
-
- /**
- * set the extensions base class name. Valid only when the isExtension
- * retruns true
- *
- * @param extensionClassName
- * @return
- */
- public String getExtensionClassName() {
- return extensionClassName;
- }
-
- /**
- * set the extensions base class name. Valid only when the isExtension
- * retruns true
- *
- * @param extensionClassName
- */
- public void setExtensionClassName(String extensionClassName) {
- this.extensionClassName = extensionClassName;
- }
-
- /**
- * get the extension status
- *
- * @return
- */
- public boolean isExtension() {
- return extension;
- }
-
- /**
- * set the extension status
- *
- * @param extension
- */
- public void setExtension(boolean extension) {
- this.extension = extension;
- }
-
- /**
- * ge the ordered statu
- *
- * @return
- */
- public boolean isOrdered() {
- return ordered;
- }
-
- /**
- * set the ordered flag. this marks whether the
- * items are ordered or not
- *
- * @param ordered
- */
- public void setOrdered(boolean ordered) {
- this.ordered = ordered;
- }
-
- /**
- * Register a mapping
- *
- * @param qName
- * @param schemaName
- * @param javaClassName
- */
- public void registerMapping(QName qName, QName schemaName, String javaClassName) {
- registerMapping(qName, schemaName, javaClassName, SchemaConstants.ELEMENT_TYPE);
- }
-
- /**
- * Register a mapping
- *
- * @param qName
- * @param schemaName
- * @param javaClassName
- * @param type
- */
- public void registerMapping(QName qName, QName schemaName, String javaClassName, Integer type) {
- this.elementToJavaClassMap.put(qName, javaClassName);
- this.elementToSchemaQNameMap.put(qName, schemaName);
- this.specialTypeFlagMap.put(qName, type);
-
- }
-
- /**
- * Get the schema name for the given QName
- *
- * @param eltQName
- * @return
- */
- public QName getSchemaQNameForQName(QName eltQName) {
- return (QName) this.elementToSchemaQNameMap.get(eltQName);
- }
-
- /**
- * get the class name for the QName
- *
- * @param eltQName
- * @return
- */
- public String getClassNameForQName(QName eltQName) {
- return (String) this.elementToJavaClassMap.get(eltQName);
- }
-
- /**
- * Get whether a given QName is an attribute
- *
- * @param qName
- * @return
- */
- public boolean getAttributeStatusForQName(QName qName) {
- Integer attribState = (Integer) specialTypeFlagMap.get(qName);
- return attribState != null && attribState.equals(SchemaConstants.ATTRIBUTE_TYPE);
- }
-
- /**
- * Get whether a given QName represents a anyType
- *
- * @param qName
- * @return
- */
- public boolean getAnyStatusForQName(QName qName) {
- Integer anyState = (Integer) specialTypeFlagMap.get(qName);
- return anyState != null && anyState.equals(SchemaConstants.ANY_TYPE);
- }
-
- /**
- * Get whether a given QName refers to an array
- *
- * @param qName
- * @return
- */
- public boolean getArrayStatusForQName(QName qName) {
- Integer anyState = (Integer) specialTypeFlagMap.get(qName);
- return anyState != null && anyState.equals(SchemaConstants.ANY_ARRAY_TYPE);
- }
-
- /**
- * Get whether a given QName has the any attribute status
- *
- * @param qName
- * @return
- */
- public boolean getAnyAttributeStatusForQName(QName qName) {
- Integer anyState = (Integer) specialTypeFlagMap.get(qName);
- return anyState != null && anyState.equals(SchemaConstants.ANY_ATTRIBUTE_TYPE);
- }
-
- /**
- * Clears the whole set of tables.
- */
- public void clearTables() {
- this.elementToJavaClassMap.clear();
- this.elementToSchemaQNameMap.clear();
- this.elementToSchemaQNameMap.clear();
- this.elementToJavaClassMap.clear();
- this.specialTypeFlagMap.clear();
- this.qNameMaxOccursCountMap.clear();
- this.qNameMinOccursCountMap.clear();
- this.qNameOrderMap.clear();
- }
-
- /**
- * add the maxOccurs associated with a QName
- *
- * @param qName
- * @param minOccurs
- */
- public void addMinOccurs(QName qName, long minOccurs) {
- this.qNameMinOccursCountMap.put(qName, new Long(minOccurs));
- }
-
- /**
- * register a QName for the order
- *
- * @param qName
- * @param index
- */
- public void registerQNameIndex(QName qName, int index) {
- this.qNameOrderMap.put(new Integer(index), qName);
- }
-
- /**
- * Add the minOccurs associated with a QName
- *
- * @param qName
- * @return
- */
- public long getMinOccurs(QName qName) {
- Long l = (Long) this.qNameMinOccursCountMap.get(qName);
- return l != null ? l.longValue() : 1; //default for min is 1
- }
-
- /**
- * get the maxOccurs associated with a QName
- *
- * @param qName
- * @return
- */
- public long getMaxOccurs(QName qName) {
- Long l = (Long) this.qNameMaxOccursCountMap.get(qName);
- return l != null ? l.longValue() : 1; //default for max is 1
- }
-
- /**
- * Add the maxOccurs associated with a QName
- *
- * @param qName
- * @param maxOccurs
- */
- public void addMaxOccurs(QName qName, long maxOccurs) {
- this.qNameMaxOccursCountMap.put(qName, new Long(maxOccurs));
- }
-
- /**
- * @return
- * @deprecated Use #getQNameArray
- */
- public Iterator getElementQNameIterator() {
- return elementToJavaClassMap.keySet().iterator();
- }
-
- /**
- * get the QName array - may not be ordered
- *
- * @return
- */
- public QName[] getQNameArray() {
- Set keySet = elementToJavaClassMap.keySet();
- return (QName[]) keySet.toArray(new QName[keySet.size()]);
- }
-
- /**
- * Get the ordered QName array - useful in sequences where the order needs to be preserved
- * Note - #registerQNameIndex needs to be called if this is to work properly!
- *
- * @return
- */
- public QName[] getOrderedQNameArray() {
- //get the keys of the order map
- Set set = qNameOrderMap.keySet();
- int count = set.size();
- Integer[] keys = (Integer[]) set.toArray(new Integer[count]);
- Arrays.sort(keys);
-
- //Now refill the Ordered QName Array
- QName[] returnQNames = new QName[count];
- for (int i = 0; i < keys.length; i++) {
- returnQNames[i] = (QName) qNameOrderMap.get(keys[i]);
-
- }
- return returnQNames;
- }
-
-}
+package org.apache.axis2.schema;
+
+import javax.xml.namespace.QName;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This is a class used as a holder to pass on the meta information to the bean writer
+ * This meta information will be used by the writer to write the databinding conversion code
+ * Note - Metainfholders are not meant to be reused!!!. They are per-class basis and are strictly
+ * not thread safe!!!!
+ */
+public class BeanWriterMetaInfoHolder {
+
+
+ private boolean ordered = false;
+ private boolean anonymous = false;
+ private boolean extension = false;
+ private String extensionClassName = "";
+ private Map elementToSchemaQNameMap = new HashMap();
+ private Map elementToJavaClassMap = new HashMap();
+ private Map specialTypeFlagMap = new HashMap();
+ private Map qNameMaxOccursCountMap = new HashMap();
+ private Map qNameMinOccursCountMap = new HashMap();
+ private Map qNameOrderMap = new HashMap();
+
+ /**
+ * get the anon status
+ *
+ * @return
+ */
+ public boolean isAnonymous() {
+ return anonymous;
+ }
+
+ /**
+ * Set the anonymous flag
+ *
+ * @param anonymous
+ */
+ public void setAnonymous(boolean anonymous) {
+ this.anonymous = anonymous;
+ }
+
+ /**
+ * set the extensions base class name. Valid only when the isExtension
+ * retruns true
+ *
+ * @return Returns String.
+ */
+ public String getExtensionClassName() {
+ return extensionClassName;
+ }
+
+ /**
+ * set the extensions base class name. Valid only when the isExtension
+ * retruns true
+ *
+ * @param extensionClassName
+ */
+ public void setExtensionClassName(String extensionClassName) {
+ this.extensionClassName = extensionClassName;
+ }
+
+ /**
+ * get the extension status
+ *
+ * @return Returns boolean.
+ */
+ public boolean isExtension() {
+ return extension;
+ }
+
+ /**
+ * set the extension status
+ *
+ * @param extension
+ */
+ public void setExtension(boolean extension) {
+ this.extension = extension;
+ }
+
+ /**
+ * ge the ordered statu
+ *
+ * @return Returns boolean.
+ */
+ public boolean isOrdered() {
+ return ordered;
+ }
+
+ /**
+ * set the ordered flag. this marks whether the
+ * items are ordered or not
+ *
+ * @param ordered
+ */
+ public void setOrdered(boolean ordered) {
+ this.ordered = ordered;
+ }
+
+ /**
+ * Register a mapping
+ *
+ * @param qName
+ * @param schemaName
+ * @param javaClassName
+ */
+ public void registerMapping(QName qName, QName schemaName, String javaClassName) {
+ registerMapping(qName, schemaName, javaClassName, SchemaConstants.ELEMENT_TYPE);
+ }
+
+ /**
+ * Register a mapping
+ *
+ * @param qName
+ * @param schemaName
+ * @param javaClassName
+ * @param type
+ */
+ public void registerMapping(QName qName, QName schemaName, String javaClassName, Integer type) {
+ this.elementToJavaClassMap.put(qName, javaClassName);
+ this.elementToSchemaQNameMap.put(qName, schemaName);
+ this.specialTypeFlagMap.put(qName, type);
+
+ }
+
+ /**
+ * Get the schema name for the given QName
+ *
+ * @param eltQName
+ * @return Returns QName.
+ */
+ public QName getSchemaQNameForQName(QName eltQName) {
+ return (QName) this.elementToSchemaQNameMap.get(eltQName);
+ }
+
+ /**
+ * get the class name for the QName
+ *
+ * @param eltQName
+ * @return Returns String.
+ */
+ public String getClassNameForQName(QName eltQName) {
+ return (String) this.elementToJavaClassMap.get(eltQName);
+ }
+
+ /**
+ * Get whether a given QName is an attribute
+ *
+ * @param qName
+ * @return Returns boolean.
+ */
+ public boolean getAttributeStatusForQName(QName qName) {
+ Integer attribState = (Integer) specialTypeFlagMap.get(qName);
+ return attribState != null && attribState.equals(SchemaConstants.ATTRIBUTE_TYPE);
+ }
+
+ /**
+ * Get whether a given QName represents a anyType
+ *
+ * @param qName
+ * @return Returns boolean.
+ */
+ public boolean getAnyStatusForQName(QName qName) {
+ Integer anyState = (Integer) specialTypeFlagMap.get(qName);
+ return anyState != null && anyState.equals(SchemaConstants.ANY_TYPE);
+ }
+
+ /**
+ * Get whether a given QName refers to an array
+ *
+ * @param qName
+ * @return Returns boolean.
+ */
+ public boolean getArrayStatusForQName(QName qName) {
+ Integer anyState = (Integer) specialTypeFlagMap.get(qName);
+ return anyState != null && anyState.equals(SchemaConstants.ANY_ARRAY_TYPE);
+ }
+
+ /**
+ * Get whether a given QName has the any attribute status
+ *
+ * @param qName
+ * @return Returns boolean.
+ */
+ public boolean getAnyAttributeStatusForQName(QName qName) {
+ Integer anyState = (Integer) specialTypeFlagMap.get(qName);
+ return anyState != null && anyState.equals(SchemaConstants.ANY_ATTRIBUTE_TYPE);
+ }
+
+ /**
+ * Clears the whole set of tables.
+ */
+ public void clearTables() {
+ this.elementToJavaClassMap.clear();
+ this.elementToSchemaQNameMap.clear();
+ this.elementToSchemaQNameMap.clear();
+ this.elementToJavaClassMap.clear();
+ this.specialTypeFlagMap.clear();
+ this.qNameMaxOccursCountMap.clear();
+ this.qNameMinOccursCountMap.clear();
+ this.qNameOrderMap.clear();
+ }
+
+ /**
+ * add the maxOccurs associated with a QName
+ *
+ * @param qName
+ * @param minOccurs
+ */
+ public void addMinOccurs(QName qName, long minOccurs) {
+ this.qNameMinOccursCountMap.put(qName, new Long(minOccurs));
+ }
+
+ /**
+ * register a QName for the order
+ *
+ * @param qName
+ * @param index
+ */
+ public void registerQNameIndex(QName qName, int index) {
+ this.qNameOrderMap.put(new Integer(index), qName);
+ }
+
+ /**
+ * Add the minOccurs associated with a QName
+ *
+ * @param qName
+ * @return
+ */
+ public long getMinOccurs(QName qName) {
+ Long l = (Long) this.qNameMinOccursCountMap.get(qName);
+ return l != null ? l.longValue() : 1; //default for min is 1
+ }
+
+ /**
+ * get the maxOccurs associated with a QName
+ *
+ * @param qName
+ * @return Returns long.
+ */
+ public long getMaxOccurs(QName qName) {
+ Long l = (Long) this.qNameMaxOccursCountMap.get(qName);
+ return l != null ? l.longValue() : 1; //default for max is 1
+ }
+
+ /**
+ * Add the maxOccurs associated with a QName
+ *
+ * @param qName
+ * @param maxOccurs
+ */
+ public void addMaxOccurs(QName qName, long maxOccurs) {
+ this.qNameMaxOccursCountMap.put(qName, new Long(maxOccurs));
+ }
+
+ /**
+ * @return Returns Iterator.
+ * @deprecated Use #getQNameArray
+ */
+ public Iterator getElementQNameIterator() {
+ return elementToJavaClassMap.keySet().iterator();
+ }
+
+ /**
+ * get the QName array - may not be ordered
+ *
+ * @return Returns QName[].
+ */
+ public QName[] getQNameArray() {
+ Set keySet = elementToJavaClassMap.keySet();
+ return (QName[]) keySet.toArray(new QName[keySet.size()]);
+ }
+
+ /**
+ * Get the ordered QName array - useful in sequences where the order needs to be preserved
+ * Note - #registerQNameIndex needs to be called if this is to work properly!
+ *
+ * @return Returns QName[].
+ */
+ public QName[] getOrderedQNameArray() {
+ //get the keys of the order map
+ Set set = qNameOrderMap.keySet();
+ int count = set.size();
+ Integer[] keys = (Integer[]) set.toArray(new Integer[count]);
+ Arrays.sort(keys);
+
+ //Now refill the Ordered QName Array
+ QName[] returnQNames = new QName[count];
+ for (int i = 0; i < keys.length; i++) {
+ returnQNames[i] = (QName) qNameOrderMap.get(keys[i]);
+
+ }
+ return returnQNames;
+ }
+
+}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java?rev=366421&r1=366420&r2=366421&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/BeanWriter.java Thu Jan 5 20:26:39 2006
@@ -1,89 +1,89 @@
-package org.apache.axis2.schema.writer;
-
-import org.apache.axis2.schema.BeanWriterMetaInfoHolder;
-import org.apache.axis2.schema.CompilerOptions;
-import org.apache.axis2.schema.SchemaCompilationException;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaSimpleType;
-
-import java.io.IOException;
-import java.util.Map;
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * The bean writer interface. The schema compiler expects one of these to be
- * presented to it and calls the appropriate methods
- */
-public interface BeanWriter {
-
-
- /**
- * Init the write with compiler options
- *
- * @param options
- * @throws IOException
- */
- public void init(CompilerOptions options) throws SchemaCompilationException;
-
- /**
- * Writes a wrapped class. This will have effect only if the CompilerOptions wrapclassses
- * returns true
- */
- public void writeBatch() throws SchemaCompilationException;
-
- /**
- * Gets a map of models. this is useful for tight integrations where the internal workings
- * of the schema compiler may be exposed.
- */
- public Map getModelMap();
-
- /**
- * Write a complex type
- *
- * @param complexType
- * @param typeMap
- * @param metainf
- * @return
- * @throws SchemaCompilationException
- */
- public String write(XmlSchemaComplexType complexType, Map typeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException;
-
- /**
- * Write a element
- *
- * @param element
- * @param typeMap
- * @param metainf
- * @return
- * @throws SchemaCompilationException
- */
- public String write(XmlSchemaElement element, Map typeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException;
-
-
- /**
- * Write a simple type
- *
- * @param simpleType
- * @param typeMap
- * @param metainf
- * @return
- * @throws SchemaCompilationException
- */
- public String write(XmlSchemaSimpleType simpleType, Map typeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException;
-
-}
+package org.apache.axis2.schema.writer;
+
+import org.apache.axis2.schema.BeanWriterMetaInfoHolder;
+import org.apache.axis2.schema.CompilerOptions;
+import org.apache.axis2.schema.SchemaCompilationException;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+
+import java.io.IOException;
+import java.util.Map;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * The bean writer interface. The schema compiler expects one of these to be
+ * presented to it and calls the appropriate methods
+ */
+public interface BeanWriter {
+
+
+ /**
+ * Initializes the writer with compiler options.
+ *
+ * @param options
+ * @throws IOException
+ */
+ public void init(CompilerOptions options) throws SchemaCompilationException;
+
+ /**
+ * Writes a wrapped class. This will have effect only if the CompilerOptions wrapclassses
+ * returns true.
+ */
+ public void writeBatch() throws SchemaCompilationException;
+
+ /**
+ * Gets a map of models. This is useful for tight integrations where the internal workings
+ * of the schema compiler may be exposed.
+ */
+ public Map getModelMap();
+
+ /**
+ * Write a complex type
+ *
+ * @param complexType
+ * @param typeMap
+ * @param metainf
+ * @return Returns String.
+ * @throws SchemaCompilationException
+ */
+ public String write(XmlSchemaComplexType complexType, Map typeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException;
+
+ /**
+ * Write a element
+ *
+ * @param element
+ * @param typeMap
+ * @param metainf
+ * @return Returns String.
+ * @throws SchemaCompilationException
+ */
+ public String write(XmlSchemaElement element, Map typeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException;
+
+
+ /**
+ * Write a simple type
+ *
+ * @param simpleType
+ * @param typeMap
+ * @param metainf
+ * @return Returns String.
+ * @throws SchemaCompilationException
+ */
+ public String write(XmlSchemaSimpleType simpleType, Map typeMap, BeanWriterMetaInfoHolder metainf) throws SchemaCompilationException;
+
+}