You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/09/01 22:14:26 UTC
svn commit: r991684 -
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ.Openwire.Generator/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
Author: tabish
Date: Wed Sep 1 20:14:26 2010
New Revision: 991684
URL: http://svn.apache.org/viewvc?rev=991684&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
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=991684&r1=991683&r2=991684&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:14:26 2010
@@ -104,6 +104,7 @@ public class CommandClassGenerator exten
out.println(" {");
out.println(" return Equals(("+getClassName()+") that);");
out.println(" }");
+ out.println("");
out.println(" return false;");
out.println(" }");
out.println("");
@@ -202,6 +203,11 @@ public class CommandClassGenerator exten
protected void generateToStringBody( PrintWriter out ) {
+ if( getProperties().isEmpty() ) {
+ out.println(" return GetType().Name + \"[ ]\";");
+ return;
+ }
+
out.println(" return GetType().Name + \"[ \" + ");
if( getBaseClassName().equals( "BaseCommand" ) ) {
@@ -277,16 +283,19 @@ public class CommandClassGenerator exten
protected void generateEqualsBody( PrintWriter out ) {
- for( JProperty property : getProperties() ) {
- String accessorName = property.getSimpleName();
+ if( !getProperties().isEmpty() ) {
+ for( JProperty property : getProperties() ) {
+ String accessorName = property.getSimpleName();
- out.println(" if(!Equals(this."+accessorName+", that."+accessorName+"))");
- out.println(" {");
- out.println(" return false;");
- out.println(" }");
+ out.println(" if(!Equals(this."+accessorName+", that."+accessorName+"))");
+ out.println(" {");
+ out.println(" return false;");
+ out.println(" }");
+ }
+
+ out.println("");
}
- out.println("");
out.println(" return true;");
}