Author: tabish
Date: Wed Sep  1 20:05:52 2010
New Revision: 991677

URL: http://svn.apache.org/viewvc?rev=991677&view=rev
Log:
Update the NMS Commands and Marshalers generator to produce somewhat cleaner 
code, removes unneeded using statements.

Modified:
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java?rev=991677&r1=991676&r2=991677&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
 Wed Sep  1 20:05:52 2010
@@ -197,7 +197,7 @@ public class CommandClassGenerator exten
     }
 
     protected void generateVisitBody( PrintWriter out ) {
-        out.println("            return visitor.process"+getClassName()+"( 
this );");
+        out.println("            return 
visitor.process"+getClassName()+"(this);");
     }
 
     protected void generateToStringBody( PrintWriter out ) {
@@ -257,17 +257,22 @@ public class CommandClassGenerator exten
     }
 
     protected void generateHashCodeBody( PrintWriter out ) {
-        out.println("            int answer = 0;");
-        out.println("");
 
-        for( JProperty property : getProperties() ) {
-            String accessorName = property.getSimpleName();
+        if( getProperties().isEmpty() ) {
+            out.println("            return HashCode(this);");
+        } else {
+            out.println("            int answer = 0;");
+            out.println("");
 
-            out.println("            answer = (answer * 37) + 
HashCode("+accessorName+");");
-        }
+            for( JProperty property : getProperties() ) {
+                String accessorName = property.getSimpleName();
 
-        out.println("");
-        out.println("            return answer;");
+                out.println("            answer = (answer * 37) + 
HashCode("+accessorName+");");
+            }
+
+            out.println("");
+            out.println("            return answer;");
+        }
     }
 
     protected void generateEqualsBody( PrintWriter out ) {

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java?rev=991677&r1=991676&r2=991677&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/marshalers/AmqCSharpMarshallersGenerator.java
 Wed Sep  1 20:05:52 2010
@@ -343,14 +343,6 @@ out.println(" */");
         out.println(" *");
         out.println(" */");
         out.println("");
-        out.println("using System;");
-        out.println("using System.Collections;");
-        out.println("using System.IO;");
-        out.println("");
-        out.println("using Apache.NMS.ActiveMQ.Commands;");
-        out.println("using Apache.NMS.ActiveMQ.OpenWire;");
-        out.println("using Apache.NMS.ActiveMQ.OpenWire.V" + 
getOpenwireVersion() + ";");
-        out.println("");
         out.println("namespace Apache.NMS.ActiveMQ.OpenWire.V" + 
getOpenwireVersion() + "");
         out.println("{");
         out.println("    /// <summary>");


Reply via email to