axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser BeanSerializer.java
Date Thu, 21 Feb 2002 19:25:07 GMT
tomj        02/02/21 11:25:07

  Modified:    java/src/org/apache/axis/wsdl/toJava
                        JavaComplexTypeWriter.java
               java/src/org/apache/axis/encoding/ser BeanSerializer.java
  Log:
  Change the return value of getAttributeElements() for bean types from a Vector
  to a String[].
  
  Revision  Changes    Path
  1.8       +11 -4     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaComplexTypeWriter.java
  
  Index: JavaComplexTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaComplexTypeWriter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JavaComplexTypeWriter.java	21 Feb 2002 18:51:23 -0000	1.7
  +++ JavaComplexTypeWriter.java	21 Feb 2002 19:25:07 -0000	1.8
  @@ -215,12 +215,19 @@
          // if we have attributes, create metadata function which returns the
          // list of properties that are attributes instead of elements
          if (attributes != null) {
  -           pw.println("    public static java.util.Vector getAttributeElements() {");
  -           pw.println("        java.util.Vector v = new java.util.Vector();");
  +           pw.println("    // List of fields that are XML attributes");
  +           pw.println("    public static java.lang.String[] _attrs = new String[] {");
              for (int i=0; i < attributes.size(); i+=2) {
  -               pw.println("        v.add(\"" + Utils.xmlNameToJava((String) attributes.get(i
+ 1)) + "\");");
  +               pw.println("        \"" + Utils.xmlNameToJava((String) attributes.get(i
+ 1)) + "\", ");
              }
  -           pw.println("        return v;");
  +           pw.println("    };");
  +           pw.println();
  +           
  +           pw.println("    /**");
  +           pw.println("     * Return list of bean field names that are attributes");
  +           pw.println("     */");
  +           pw.println("    public static java.lang.String[] getAttributeElements() {");
  +           pw.println("        return _attrs;");
              pw.println("    }");
              pw.println();
          }
  
  
  
  1.7       +9 -3      xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BeanSerializer.java	21 Feb 2002 18:51:23 -0000	1.6
  +++ BeanSerializer.java	21 Feb 2002 19:25:07 -0000	1.7
  @@ -237,9 +237,15 @@
               Method getAttributeElements = 
                       javaType.getMethod("getAttributeElements",
                                          new Class [] {});
  -            
  -            return (Vector) getAttributeElements.invoke(null, noArgs);
  -            
  +            // get string array
  +            String[] array = (String[])getAttributeElements.invoke(null, noArgs);
  +
  +            // convert it to a Vector
  +            Vector v = new Vector(array.length);
  +            for (int i = 0; i < array.length; i++) {
  +                v.add(array[i]);
  +            }
  +            return v;
           } catch (Exception e) {
               return new Vector();  // empty vector
           }
  
  
  

Mime
View raw message