Skip to content
Permalink
Browse files
Clean up the generated to String methods for the commands to make the…
… logging easier to read.
  • Loading branch information
Timothy A. Bish committed Dec 16, 2009
1 parent e5b5b32 commit 33428d8bd942858fcd24016ac61f0be36e49c410
Showing 6 changed files with 52 additions and 2 deletions.
@@ -207,12 +207,17 @@ protected void generateVisitBody( PrintWriter out ) {

protected void generateToStringBody( PrintWriter out ) {

out.println(" return GetType().Name + \"[\" + ");
out.println(" return GetType().Name + \"[ \" + ");

if( getBaseClassName().equals( "BaseCommand" ) ) {
out.println(" \"commandId = \" + this.CommandId + \" \" + " );
out.println(" \"responseRequired = \" + this.ResponseRequired + \" \" + " );
}

for( JProperty property : getProperties() ) {
String name = property.getSimpleName();

out.println(" \"" + name + "=\" + " + name + " + " );
out.println(" \"" + name + " = \" + " + name + " + \" \" + " );
}

out.println(" \"]\";");
@@ -18,6 +18,8 @@

import java.io.PrintWriter;

import org.codehaus.jam.JProperty;

public class ConnectionIdGenerator extends CommandClassGenerator {

protected void generateConstructors( PrintWriter out ) {
@@ -43,4 +45,8 @@ protected void generateConstructors( PrintWriter out ) {

super.generateConstructors(out);
}

protected void generateToStringBody( PrintWriter out ) {
out.println(" return this.value;");
}
}
@@ -37,6 +37,10 @@ protected void generateConstructors( PrintWriter out ) {
super.generateConstructors(out);
}

protected void generateToStringBody( PrintWriter out ) {
out.println(" return this.connectionId + \":\" + this.sessionId + \":\" + this.value;");
}

protected void generateProperties( PrintWriter out ) {

out.println(" private SessionId parentId = null;");
@@ -0,0 +1,27 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.nms.openwire.tool.commands;

import java.io.PrintWriter;

public class LocalTransactionIdGenerator extends CommandClassGenerator {

protected void generateToStringBody( PrintWriter out ) {
out.println(" return this.connectionId + \":\" + this.value;");
}

}
@@ -56,6 +56,10 @@ protected void generateProperties( PrintWriter out ) {
super.generateProperties(out);
}

protected void generateToStringBody( PrintWriter out ) {
out.println(" return this.connectionId + \":\" + this.sessionId + \":\" + this.value;");
}

protected void generateAdditonalMembers( PrintWriter out ) {
out.println(" public SessionId ParentId");
out.println(" {");
@@ -56,6 +56,10 @@ protected void generateProperties( PrintWriter out ) {
super.generateProperties(out);
}

protected void generateToStringBody( PrintWriter out ) {
out.println(" return this.connectionId + \":\" + this.value;");
}

protected void generateAdditonalMembers( PrintWriter out ) {
out.println(" public ConnectionId ParentId");
out.println(" {");

0 comments on commit 33428d8

Please sign in to comment.