This is an automated email from the ASF dual-hosted git repository. dfoulks pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-nms-openwire-generator.git
commit 80da5b3dcfddaef0450ab5dd9f1b877d540b290a Author: Timothy A. Bish <[email protected]> AuthorDate: Thu Jul 30 15:32:31 2009 +0000 Cleans up the generated code a bit to match the existing coding conventions. --- .../nms/openwire/tool/commands/CommandClassGenerator.java | 10 ++++++---- .../nms/openwire/tool/commands/ConsumerIdGenerator.java | 6 ++++-- .../nms/openwire/tool/commands/ProducerIdGenerator.java | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-) 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 40386eb..89d0aee 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 @@ -55,11 +55,8 @@ public class CommandClassGenerator extends CommandCodeGenerator { generateProperties( out ); - out.println(""); - generateConstructors(out); - out.println(""); out.println(" ///"); out.println(" /// <summery>"); out.println(" /// Get the unique identifier that this object and its own"); @@ -155,7 +152,6 @@ public class CommandClassGenerator extends CommandCodeGenerator { } out.println(" };"); - out.println(""); out.println("}"); out.println(""); } @@ -187,12 +183,18 @@ public class CommandClassGenerator extends CommandCodeGenerator { protected void generateProperties( PrintWriter out ) { + if( getProperties().isEmpty() ) { + return; + } + for( JProperty property : getProperties() ) { String type = toCSharpType(property.getType()); String name = decapitalize(property.getSimpleName()); out.println(" "+type+" "+name+";"); } + + out.println(""); } protected void generateVisitBody( PrintWriter out ) { diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java index 396a85c..dd0f666 100644 --- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java +++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java @@ -22,10 +22,12 @@ public class ConsumerIdGenerator extends CommandClassGenerator { protected void generateConstructors( PrintWriter out ) { - out.println(" public "+getClassName()+"() {"); + out.println(" public "+getClassName()+"()"); + out.println(" {"); out.println(" }"); out.println(""); - out.println(" public "+getClassName()+"( SessionId sessionId, long consumerId ) {"); + out.println(" public "+getClassName()+"( SessionId sessionId, long consumerId )"); + out.println(" {"); out.println(" this.connectionId = sessionId.ConnectionId;"); out.println(" this.sessionId = sessionId.Value;"); out.println(" this.value = consumerId;"); diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java index c42817a..46db0eb 100644 --- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java +++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java @@ -22,10 +22,12 @@ public class ProducerIdGenerator extends CommandClassGenerator { protected void generateConstructors( PrintWriter out ) { - out.println(" public "+getClassName()+"() {"); + out.println(" public "+getClassName()+"()"); + out.println(" {"); out.println(" }"); out.println(""); - out.println(" public "+getClassName()+"( SessionId sessionId, long consumerId ) {"); + out.println(" public "+getClassName()+"( SessionId sessionId, long consumerId )"); + out.println(" {"); out.println(" this.connectionId = sessionId.ConnectionId;"); out.println(" this.sessionId = sessionId.Value;"); out.println(" this.value = consumerId;");
