Added timestamp and methods to retrieve attribute and property names.

This commit is contained in:
Mark Fisher
2008-01-16 22:09:54 +00:00
parent 2ffae06824
commit 8225cb1405
2 changed files with 82 additions and 0 deletions

View File

@@ -17,8 +17,10 @@
package org.springframework.integration.message;
import java.util.Date;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
@@ -36,6 +38,8 @@ public class MessageHeader {
private String replyChannelName;
private Date timestamp = new Date();
private Date expiration;
private int sequenceNumber = 1;
@@ -67,6 +71,10 @@ public class MessageHeader {
return this.sequenceNumber;
}
public Date getTimestamp() {
return this.timestamp;
}
/**
* Set the expiration date for this message or <code>null</code> to
* indicate 'never expire'. The default is <code>null</code>.
@@ -103,6 +111,14 @@ public class MessageHeader {
this.properties.setProperty(key, value);
}
public Set<String> getPropertyNames() {
Set<String> propertyNames = new HashSet<String>();
for (Object key : this.properties.keySet()) {
propertyNames.add((String) key);
}
return propertyNames;
}
public Object getAttribute(String key) {
return this.attributes.get(key);
}
@@ -111,4 +127,8 @@ public class MessageHeader {
this.attributes.put(key, value);
}
public Set<String> getAttributeNames() {
return this.attributes.keySet();
}
}