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 Tue, 15 Jun 2004 21:23:36 GMT
dims        2004/06/15 14:23:36

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaBeanWriter.java
  Log:
  Fix for  AXIS-1396 - compile error on constructor created with wsdl2java
  
  Revision  Changes    Path
  1.63      +34 -1     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.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- JavaBeanWriter.java	15 Jun 2004 09:51:14 -0000	1.62
  +++ JavaBeanWriter.java	15 Jun 2004 21:23:36 -0000	1.63
  @@ -27,6 +27,7 @@
   import javax.xml.namespace.QName;
   import java.io.IOException;
   import java.io.PrintWriter;
  +import java.io.StringWriter;
   import java.util.ArrayList;
   import java.util.HashSet;
   import java.util.Iterator;
  @@ -73,7 +74,7 @@
       protected boolean enableDefaultConstructor = true;
   
       /** Field enableFullConstructor */
  -    protected boolean enableFullConstructor = true;
  +    protected boolean enableFullConstructor = false;
   
       /** Field enableSimpleConstructors */
       protected boolean enableSimpleConstructors = false;
  @@ -204,6 +205,8 @@
           // Write Full Constructor
           if (enableFullConstructor) {
               writeFullConstructor();
  +        } else {
  +            writeMinimalConstructor();
           }
   
           // Write SimpleConstructors
  @@ -485,6 +488,36 @@
           pw.println();
       }
   
  +    protected void writeMinimalConstructor() {
  +
  +        if (isUnion() || names.size() == 0) {
  +            return;
  +        }
  +
  +        pw.println("    public " + className + "(");
  +        for (int i = 0; i < names.size(); i += 2) {
  +            String typeName = (String) names.get(i);
  +            String variable = (String) names.get(i + 1);
  +            pw.print("           " + typeName + " "
  +                    + variable);
  +            if (i >= names.size() - 2) {
  +                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 + ";");
  +            if (i >= names.size() - 2) {
  +                break;
  +            }
  +        }
  +        pw.println("    }");
  +        pw.println();
  +    }
  +    
       /**
        * Writes the full constructor.
        * Note that this class is not recommended for
  
  
  

Mime
View raw message