Update the NMS Commands and Marshalers generator to produce somewhat cleaner code, removes unneeded using statements.
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index fc2c229..20c4782 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -104,6 +104,7 @@
out.println(" {");
out.println(" return Equals(("+getClassName()+") that);");
out.println(" }");
+ out.println("");
out.println(" return false;");
out.println(" }");
out.println("");
@@ -202,6 +203,11 @@
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 @@
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;");
}