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/12/31 15:59:41 UTC

svn commit: r491428 - /webservices/axis2/branches/java/1_1/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl

Author: dims
Date: Sun Dec 31 06:59:40 2006
New Revision: 491428

URL: http://svn.apache.org/viewvc?view=rev&rev=491428
Log:
optimize string array conversion

Modified:
    webservices/axis2/branches/java/1_1/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl

Modified: webservices/axis2/branches/java/1_1/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?view=diff&rev=491428&r1=491427&r2=491428
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/branches/java/1_1/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Sun Dec 31 06:59:40 2006
@@ -1916,10 +1916,18 @@
                                                 }
                                             }
                                             // call the converter utility  to convert and set the array
-                                            object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                    <xsl:value-of select="$basePropertyType"/>.class,
-                                                    <xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,
+                                                            <xsl:value-of select="$listName"/>));
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:when>
                                         <!-- End of Array handling of ADB classes -->
 
@@ -1951,9 +1959,17 @@
 
                                              }
 
-                                             object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                 org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                     <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:when>
 
                                         <!-- End of Array handling of ADB classes -->
@@ -1998,10 +2014,17 @@
 
                                              }
 
-                                             object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                 org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                     <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
-
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:when>
 
                                         <!-- handling binary case -->
@@ -2099,10 +2122,17 @@
                                                     }
                                                 }
                                                 // call the converter utility  to convert and set the array
-                                                object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                        <xsl:value-of select="$basePropertyType"/>.class,
-                                                        <xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:when>
 
                                         <xsl:otherwise>
@@ -2146,9 +2176,17 @@
 
                                              }
 
-                                             object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                 org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                     <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                                 <xsl:choose>
+                                                     <xsl:when test="$basePropertyType='java.lang.String'">
+                                                         object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                             <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
+                                                     </xsl:when>
+                                                     <xsl:otherwise>
+                                                         object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                             org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                                 <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                                     </xsl:otherwise>
+                                                 </xsl:choose>
 
                                         </xsl:when>
                                         <!-- End of Array handling of default class - that is the OMElement -->
@@ -2192,10 +2230,17 @@
                                                 }
                                             }
                                             // call the converter utility  to convert and set the array
-                                            object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                    <xsl:value-of select="$basePropertyType"/>.class,
-                                                    <xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        <xsl:value-of select="$listName"/>.toArray(new <xsl:value-of select="$basePropertyType"/>[<xsl:value-of select="$listName"/>.size()]));
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:otherwise>
                                         </xsl:choose>
                                         </xsl:otherwise>
@@ -3186,10 +3231,18 @@
                                                 }
                                             }
                                             // call the converter utility  to convert and set the array
-                                            object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                    <xsl:value-of select="$basePropertyType"/>.class,
-                                                    <xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$listName"/>);
+
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:when>
 
                                         <!--Let's handle xs:any here-->
@@ -3226,9 +3279,18 @@
 
                                              }
 
-                                             object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                 org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                     <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$listName"/>);
+
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:when>
 
 
@@ -3275,9 +3337,18 @@
 
                                              }
 
-                                             object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                 org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                     <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$listName"/>);
+
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+
+                                                </xsl:otherwise>
+                                            </xsl:choose>
 
                                         </xsl:when>
                                         <!-- End of Array handling of default class - that is the OMElement -->
@@ -3307,10 +3378,18 @@
                                                 }
                                             }
                                             // call the converter utility  to convert and set the array
-                                            object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
-                                                org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
-                                                    <xsl:value-of select="$basePropertyType"/>.class,
-                                                    <xsl:value-of select="$listName"/>));
+                                            <xsl:choose>
+                                                <xsl:when test="$basePropertyType='java.lang.String'">
+                                                    object.set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$listName"/>);
+
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    object.set<xsl:value-of select="$javaName"/>((<xsl:value-of select="$propertyType"/>)
+                                                        org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
+                                                            <xsl:value-of select="$basePropertyType"/>.class,<xsl:value-of select="$listName"/>));
+
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:otherwise>
                                     </xsl:choose>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org