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 6787e107d1ca90817dd9601118b53d7c6fa70975
Author: Timothy A. Bish <[email protected]>
AuthorDate: Thu Oct 22 21:36:53 2009 +0000

    Update to add an attempt at the IsExpired method needed in Message
---
 .../openwire/tool/commands/CommandClassGenerator.java  | 18 +++++++++++-------
 .../nms/openwire/tool/commands/MessageGenerator.java   | 11 +++++++++++
 2 files changed, 22 insertions(+), 7 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 89d0aee..0ca7efc 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
@@ -27,13 +27,7 @@ public class CommandClassGenerator extends 
CommandCodeGenerator {
         // Start with the license.
         generateLicence(out);
 
-        out.println("using System;");
-        out.println("using System.Collections;");
-
-        if( getBaseClassName().equals( "BaseCommand" ) ) {
-            out.println("");
-            out.println("using Apache.NMS.ActiveMQ.State;");
-        }
+        generateUsingDirectives(out);
 
         out.println("");
         out.println("namespace Apache.NMS.ActiveMQ.Commands");
@@ -156,6 +150,16 @@ public class CommandClassGenerator extends 
CommandCodeGenerator {
         out.println("");
     }
 
+    protected void generateUsingDirectives( PrintWriter out ) {
+        out.println("using System;");
+        out.println("using System.Collections;");
+
+        if( getBaseClassName().equals( "BaseCommand" ) ) {
+            out.println("");
+            out.println("using Apache.NMS.ActiveMQ.State;");
+        }
+    }
+
     protected void generateClassDefinition( PrintWriter out ) {
         out.print("    public class "+getClassName()+" : " );
 
diff --git 
a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
 
b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
index 356b133..eba6084 100644
--- 
a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
+++ 
b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/MessageGenerator.java
@@ -26,6 +26,12 @@ public class MessageGenerator extends CommandClassGenerator {
         super.addAdditionalBase("MessageReference");
     }
 
+    protected void generateUsingDirectives( PrintWriter out ) {
+        super.generateUsingDirectives(out);
+
+        out.println("using Apache.NMS.Util;");
+    }
+
     protected void generateProperties( PrintWriter out ) {
 
         super.generateProperties(out);
@@ -82,6 +88,11 @@ public class MessageGenerator extends CommandClassGenerator {
         out.println("            this.ReadOnlyBody = true;");
         out.println("        }");
         out.println("");
+        out.println("        public bool IsExpired()");
+        out.println("        {");
+        out.println("            return this.expiration == 0 ? false : 
DateTime.UtcNow > DateUtils.ToDateTimeUtc(this.expiration);");
+        out.println("        }");
+        out.println("");
     }
 
     protected void generateCloneBody( PrintWriter out ) {

Reply via email to