com.orderlysoftware.orderlycalls.base
Class Message

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap
              extended by com.orderlysoftware.orderlycalls.base.Message
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map
Direct Known Subclasses:
ManagerAction, ManagerEvent, ManagerResponse

public class Message
extends java.util.LinkedHashMap

This class represents an ordered set of key-value Pairs, with an option amount of free-text data, suitable for use with Asterisk's Manager API.

The iteration order is the order in which keys were added.

Author:
Matt King, M.A. Oxon.
See Also:
Serialized Form

Constructor Summary
Message()
           
 
Method Summary
 void addPair(Pair pair)
          Convenience method to add a key-value Pair.
 void addPair(java.lang.String key, java.lang.String value)
          Another convenience method for adding a key-value pair.
 java.lang.StringBuffer getFreeform()
          Gets freeform (unpaired) data associated with this message.
 java.lang.String getValue(java.lang.String key)
          Gets a particular value.
 boolean isComplete()
          Tests whether this message is complete.
 void setComplete(boolean complete)
          Indicates that this message is finished.
 void setFreeform(java.lang.StringBuffer freeform)
          Messages may be accompanied by data that does not conform to the "key: value" format.
 java.lang.String toString()
          Returns a string that is a list of "key: value" pairs, terminated by a blank line.
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get, removeEldestEntry
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

Message

public Message()
Method Detail

addPair

public void addPair(Pair pair)
Convenience method to add a key-value Pair.

Parameters:
pair - The Pair to add.

getValue

public java.lang.String getValue(java.lang.String key)
Gets a particular value.

Parameters:
key -
Returns:
the value.

toString

public java.lang.String toString()
Returns a string that is a list of "key: value" pairs, terminated by a blank line.

Overrides:
toString in class java.util.AbstractMap

addPair

public void addPair(java.lang.String key,
                    java.lang.String value)
Another convenience method for adding a key-value pair.

Parameters:
key -
value -

getFreeform

public java.lang.StringBuffer getFreeform()
Gets freeform (unpaired) data associated with this message.

Returns:
Returns any strings that do not conform to the "key: value" format.

isComplete

public boolean isComplete()
Tests whether this message is complete.

Returns:
whether this message is finished.

setComplete

public void setComplete(boolean complete)
Indicates that this message is finished.

Parameters:
complete - The complete to set.

setFreeform

public void setFreeform(java.lang.StringBuffer freeform)
Messages may be accompanied by data that does not conform to the "key: value" format.

Parameters:
freeform - Freeform data.