Skip to content
Permalink
Browse files
Update the NMS Commands and Marshalers generator to produce somewhat …
…cleaner code, removes unneeded using statements.
  • Loading branch information
Timothy A. Bish committed Sep 1, 2010
1 parent 39165ed commit 83c9843e6575e842ff165d21134055f2874f2743
Showing 1 changed file with 16 additions and 7 deletions.
@@ -104,6 +104,7 @@ public void generate( PrintWriter out ) {
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 generateVisitBody( PrintWriter out ) {

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 generateHashCodeBody( PrintWriter out ) {

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;");
}

0 comments on commit 83c9843

Please sign in to comment.