axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dushshan...@apache.org
Subject cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal BeanParamWriter.java ParmHeaderFileWriter.java
Date Mon, 16 May 2005 11:35:26 GMT
dushshantha    2005/05/16 04:35:26

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp
                        BeanParamWriter.java ParmHeaderFileWriter.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        BeanParamWriter.java ParmHeaderFileWriter.java
  Log:
  Fix for the Jira issue AXISCPP-228 .
  
  Getters and setters of the generated class attributes are now autogenerated
  
  Revision  Changes    Path
  1.40      +84 -0     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
  
  Index: BeanParamWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- BeanParamWriter.java	11 May 2005 11:18:37 -0000	1.39
  +++ BeanParamWriter.java	16 May 2005 11:35:26 -0000	1.40
  @@ -122,6 +122,8 @@
                       writer.write("int Axis_GetSize_" + typeName + "();\n\n");
                   }
               }
  +            
  +            writeGetSetMethods();
               writeSerializeGlobalMethod();
               writeDeSerializeGlobalMethod();
               writeCreateGlobalMethod();
  @@ -134,6 +136,88 @@
           }
       }
   
  +    /**
  +	 * Dushshantha:
  +	 * following method writes getters and setters for the attributes
  +	 */
  +	
  +	private void writeGetSetMethods() throws WrapperFault{
  +		/**
  +		 * Dushshantha:
  +		 * writing getter
  +		 */
  +		
  +		if (type.isArray())
  +        {
  +            return;
  +        }
  +        try
  +        {
  +            for (int i = 0; i < attribs.length; i++){
  +            
  +                /**
  +                 * Dushshantha:
  +                 * Write getter
  +                 */
  +            	
  +            	writer.write(
  +                    "\n"
  +                        + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                        + " " 
  +						+ classname
  +						+ "::get"
  +                        + attribs[i].getParamNameWithoutSymbols()
  +                        + "()\n{\n");
  +            	
  +            	writer.write(
  +                     "\t"
  +            			+ "return "
  +						+ attribs[i].getParamNameWithoutSymbols()
  +						+ " ; \n}\n");
  +            			
  +            				
  +            	/**
  +                 * Dushshantha:
  +                 * Write setter
  +                 */
  +            	
  +            	writer.write(
  +                        "\n"
  +                            + "void "
  +							+ classname 
  +							+ "::set"
  +                            + attribs[i].getParamNameWithoutSymbols()
  +                            + "(" 
  +							+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                            + " InValue)\n{\n");
  +            	
  +            	writer.write(
  +                        "\t"
  +               			+ attribs[i].getParamNameWithoutSymbols()
  +   						+ " = InValue ; \n");
  +            	
  +            	if (attribs[i].getChoiceElement()){
  +            		for (int j = 0; j < attribs.length; j++){
  +            			if ((attribs[j].getChoiceElement())&& (j!=i))
  +            				writer.write(
  +                                    "\t"
  +                           			+ attribs[j].getParamNameWithoutSymbols()
  +               						+ " = NULL ; \n");
  +            		}
  +            	}
  +            	
  +            	writer.write("}\n");
  +                                           
  +            }
  +        }
  +        catch (IOException e)
  +        {
  +            throw new WrapperFault(e);
  +        }
  +		
  +	}
  +    
  +    
       private void writeGetSizeGlobalMethod() throws IOException
       {
           writer.write("/*\n");
  
  
  
  1.30      +52 -0     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
  
  Index: ParmHeaderFileWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ParmHeaderFileWriter.java	29 Mar 2005 06:28:17 -0000	1.29
  +++ ParmHeaderFileWriter.java	16 May 2005 11:35:26 -0000	1.30
  @@ -71,6 +71,8 @@
              		this.writer.write(" : public SoapFaultException");
               this.writer.write("\n{\n");
   
  +            writeGetSetMethods();
  +            
               writeAttributes();
               writeConstructors();
               writeDestructors();
  @@ -123,6 +125,56 @@
               throw new WrapperFault(e);
           }
       }
  +    
  +    
  +    /**
  +     * Dushshantha:
  +     * This method writes getters and setters of the attributes.
  +     */
  +     protected void writeGetSetMethods() throws WrapperFault
  +     {
  +         if (type.isArray())
  +         {
  +             return;
  +         }
  +         try
  +         {
  +             for (int i = 0; i < attribs.length; i++)
  +             {
  +                 /**
  +                  * Dushshantha:
  +                  * Write setter
  +                  */
  +             	
  +             	writer.write(
  +                     "\t"
  +                         + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                         + " get"
  +                         + attribs[i].getParamNameWithoutSymbols()
  +                         + "();\n");
  +             	
  +             	/**
  +                  * Dushshantha:
  +                  * Write getter
  +                  */
  +             	
  +             	writer.write(
  +                         "\t"
  +                             + "void set"
  +                             + attribs[i].getParamNameWithoutSymbols()
  +                             + "(" 
  + 							+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                             + " InValue);\n\n");
  +                 
  +                 
  +             }
  +         }
  +         catch (IOException e)
  +         {
  +             throw new WrapperFault(e);
  +         }
  +     }
  +     
   
       protected void writeConstructors() throws WrapperFault
       {
  
  
  
  1.71      +84 -0     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
  
  Index: BeanParamWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- BeanParamWriter.java	16 May 2005 05:14:44 -0000	1.70
  +++ BeanParamWriter.java	16 May 2005 11:35:26 -0000	1.71
  @@ -83,6 +83,8 @@
   				writer.write("int Axis_GetSize_"+typeName+"();\n\n");
   			}	
   		}
  +		
  +		writeGetSetMethods();
   		writeSerializeGlobalMethod();
   		writeDeSerializeGlobalMethod();
   		writeCreateGlobalMethod();
  @@ -92,6 +94,88 @@
   			throw new WrapperFault(e);
   		}
   	}
  +	
  +	/**
  +	 * Dushshantha:
  +	 * following method writes getters and setters for the attributes
  +	 */
  +	
  +	private void writeGetSetMethods() throws WrapperFault{
  +		/**
  +		 * Dushshantha:
  +		 * writing getter
  +		 */
  +		
  +		if (type.isArray())
  +        {
  +            return;
  +        }
  +        try
  +        {
  +            for (int i = 0; i < attribs.length; i++){
  +            
  +                /**
  +                 * Dushshantha:
  +                 * Write getter
  +                 */
  +            	
  +            	writer.write(
  +                    "\n"
  +                        + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                        + " " 
  +						+ classname
  +						+ "::get"
  +                        + attribs[i].getParamNameWithoutSymbols()
  +                        + "()\n{\n");
  +            	
  +            	writer.write(
  +                     "\t"
  +            			+ "return "
  +						+ attribs[i].getParamNameWithoutSymbols()
  +						+ " ; \n}\n");
  +            			
  +            				
  +            	/**
  +                 * Dushshantha:
  +                 * Write setter
  +                 */
  +            	
  +            	writer.write(
  +                        "\n"
  +                            + "void "
  +							+ classname 
  +							+ "::set"
  +                            + attribs[i].getParamNameWithoutSymbols()
  +                            + "(" 
  +							+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                            + " InValue)\n{\n");
  +            	
  +            	writer.write(
  +                        "\t"
  +               			+ attribs[i].getParamNameWithoutSymbols()
  +   						+ " = InValue ; \n");
  +            	
  +            	if (attribs[i].getChoiceElement()){
  +            		for (int j = 0; j < attribs.length; j++){
  +            			if ((attribs[j].getChoiceElement())&& (j!=i))
  +            				writer.write(
  +                                    "\t"
  +                           			+ attribs[j].getParamNameWithoutSymbols()
  +               						+ " = NULL ; \n");
  +            		}
  +            	}
  +            	
  +            	writer.write("}\n");
  +                                           
  +            }
  +        }
  +        catch (IOException e)
  +        {
  +            throw new WrapperFault(e);
  +        }
  +		
  +	}
  +	
   	private void writeGetSizeGlobalMethod() throws IOException{
   		writer.write("/*\n");
   		writer.write(" * This static method gives the size of "+classname+" type of object\n");
  
  
  
  1.36      +59 -1     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
  
  Index: ParmHeaderFileWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- ParmHeaderFileWriter.java	29 Mar 2005 08:16:30 -0000	1.35
  +++ ParmHeaderFileWriter.java	16 May 2005 11:35:26 -0000	1.36
  @@ -80,6 +80,14 @@
                   	this.writer.write(" : public SoapFaultException");
                   this.writer.write("\n{\n");
                   writeAttributes();
  +                
  +                /**
  +                 * Dushshantha:
  +                 * Call writeGetSetMethods() method.
  +                 */
  +                
  +                writeGetSetMethods();
  +                //..................................
                   writeConstructors();
                   writeDestructors();
                   this.writer.write("};\n\n");
  @@ -332,12 +340,62 @@
               throw new WrapperFault(e);
           }
       }
  +    
  +   /**
  +    * Dushshantha:
  +    * This method writes getters and setters of the attributes.
  +    */
  +    protected void writeGetSetMethods() throws WrapperFault
  +    {
  +        if (type.isArray())
  +        {
  +            return;
  +        }
  +        try
  +        {
  +            for (int i = 0; i < attribs.length; i++)
  +            {
  +                /**
  +                 * Dushshantha:
  +                 * Write setter
  +                 */
  +            	
  +            	writer.write(
  +                    "\n\t"
  +                        + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                        + " get"
  +                        + attribs[i].getParamNameWithoutSymbols()
  +                        + "();\n");
  +            	
  +            	/**
  +                 * Dushshantha:
  +                 * Write getter
  +                 */
  +            	
  +            	writer.write(
  +                        "\t"
  +                            + "void set"
  +                            + attribs[i].getParamNameWithoutSymbols()
  +                            + "(" 
  +							+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
  +                            + " InValue);\n");
  +                
  +                
  +            }
  +        }
  +        catch (IOException e)
  +        {
  +            throw new WrapperFault(e);
  +        }
  +    }
  +    
  +    
   
       protected void writeConstructors() throws WrapperFault
       {
           try
           {
  -            writer.write("\t" + classname + "();\n");
  +            writer.write("\n\t" + classname + "();\n");
           }
           catch (IOException e)
           {
  
  
  

Mime
View raw message