axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava JavaBeanWriter.java
Date Wed, 29 Dec 2004 17:53:31 GMT
dims        2004/12/29 09:53:31

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaBeanWriter.java
  Log:
  Sort the names to make generated code predictable
  
  Revision  Changes    Path
  1.72      +19 -7     ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
  
  Index: JavaBeanWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- JavaBeanWriter.java	14 Sep 2004 13:07:26 -0000	1.71
  +++ JavaBeanWriter.java	29 Dec 2004 17:53:30 -0000	1.72
  @@ -32,6 +32,9 @@
   import java.util.Iterator;
   import java.util.Set;
   import java.util.Vector;
  +import java.util.TreeSet;
  +import java.util.TreeMap;
  +import java.util.Map;
   
   /**
    * This is Wsdl2java's Complex Type Writer.  It writes the <typeName>.java file.
  @@ -552,19 +555,28 @@
               return;
           }
   
  -        pw.println("    public " + className + "(");
  +        // Sort by variable name.
  +        TreeMap map = new TreeMap();
           for (int i = 0; i < names.size(); i += 2) {
  -            String typeName = (String) names.get(i);
  -            String variable = (String) names.get(i + 1);
  +            map.put(names.get(i + 1),names.get(i));
  +        }        
  +        
  +        Iterator iterator = map.entrySet().iterator();
  +        pw.println("    public " + className + "(");
  +        while (iterator.hasNext()) {
  +            Map.Entry entry = (Map.Entry) iterator.next();
  +            String typeName = (String) entry.getValue();
  +            String variable = (String) entry.getKey();
               pw.print("           " + typeName + " "
                       + variable);
  -            if (i >= names.size() - 2) {
  +            if (iterator.hasNext()) {
  +                pw.println(",");
  +            } else {
                   pw.println(") {");
                   break;
  -            } else {
  -                pw.println(",");
  -            }
  +            } 
           }
  +        
           for (int i = 0; i < names.size(); i += 2) {
               String variable = (String) names.get(i + 1);
               pw.println("           this." + variable + " = " + variable + ";");
  
  
  

Mime
View raw message