Class MapMessage

Extends Message.

A MapMessage object is used to send a set of name-value pairs. The names are String objects, and the values are primitive data types in the Java programming language. The names must have a value that is not null, and not an empty string. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined. MapMessage inherits from the Message interface and adds a message body that contains a Map.

The primitive types can be read or written explicitly using methods for each type.

When a client receives a MapMessage, it is in read-only mode. If a client attempts to write to the message at this point, a MessageNotWriteableException is thrown. If clearBody is called, the message can now be both read from and written to.

MapMessage objects support the following conversion table. The marked cases must be supported. The unmarked cases must throw a JMSException. The String-to-primitive conversions may throw a runtime exception if the primitive's valueOf() method does not accept it as a valid String representation of the primitive.

A value written as the row type can be read as the column type.

|        | boolean byte short char int long float double String byte[]
|----------------------------------------------------------------------
|boolean |    X                                            X
|byte    |          X     X         X   X                  X
|short   |                X         X   X                  X
|char    |                     X                           X
|int     |                          X   X                  X
|long    |                              X                  X
|float   |                                    X     X      X
|double  |                                          X      X
|String  |    X     X     X         X   X     X     X      X
|byte[]  |                                                        X
|----------------------------------------------------------------------

Attempting to read a null value as a primitive type must be treated as calling the primitive's corresponding valueOf(String) conversion method with a null value. Since char does not support a String conversion, attempting to read a null value as a char must throw a NullPointerException.


Constructor Summary
MapMessage()
            A MapMessage object is used to send a set of name-value pairs.
 
Method Summary
 Number getByte(name)
           Returns the Number representing the integer value of the specified name
  getBytes(name)
           Returns the byte array with the specified name
 String getChar(name)
           Returns the String representing the Unicode character of the specified name
 Number getDouble(name)
           Returns the Number representing the double value of the specified name.
 Number getFloat(name)
           Returns the Number representing the float value of the specified name
 Number getLong(name)
           Returns the Number representing the long value of the specified name.
  getMapNames()
           Returns the array of names in the map message.
  getObject(name)
           Returns the object value of the specified name.
 Number getShort(name)
           Returns the Number representing the short value of the specified name
 String getString(name)
           Returns the String value of the specified name
 Boolean itemExists(name)
           Returns the Boolean value indicating whether or not specified name exists on the map.
setBoolean(name, value)
           Sets the boolean value with the specified name
setByte(name, value)
           Sets the Number representing the byte value with the specified name in the map message.
setBytes(name, value, offset, length)
           Sets the byte array with the specified name in the map message.
setBytes(name, value, offset, length)
           Sets the byte array with the specified name in the map message.
setChar(name, value)
           Sets the String representing the unicode character with the specified name in the map message.
setDouble(name, value)
           Sets the Number representing the double value with the specified name in the map message.
setFloat(name, value)
           Sets the Number representing the float value with the specified name in the map message.
setInt(name, value)
           Sets the Number representing the integer value with the specified name in the map message.
setLong(name, value)
           Sets the Number representing the long value with the specified name in the map message.
setObject(name, value)
           Sets the object value with the specified name in the map message.
setShort(name, value)
           Sets the Number representing the short value with the specified name in the map message.
setString(name, value)
           Sets the String value with the specified name in the map message.
 
Methods inherited from class Message
getJMSMessageID()
setJMSMessageID(id)
getJMSTimestamp()
setJMSTimestamp(timestamp)
setJMSCorrelationID(correlationID)
getJMSCorrelationID()
getJMSReplyTo()
setJMSReplyTo(replyTo)
getJMSDestination()
setJMSDestination(destination)
getJMSDeliveryMode()
setJMSDeliveryMode(deliveryMode)
getJMSRedelivered()
setJMSRedelivered(redelivered)
getJMSType()
setJMSType(type)
getJMSExpiration()
setJMSExpiration(expiration)
getJMSPriority()
setJMSPriority(priority)
clearProperties()
propertyExists(name)
getBooleanProperty(name)
getByteProperty(name)
getShortProperty(name)
getIntProperty(name)
getLongProperty(name)
getFloatProperty(name)
getDoubleProperty(name)
getStringProperty(name)
getObjectProperty(name)
setBooleanProperty(name, value)
setByteProperty(name, value)
setShortProperty(name, value)
setIntProperty(name, value)
setLongProperty(name, value)
setFloatProperty(name, value)
setDoubleProperty(name, value)
setStringProperty(name, value)
setObjectProperty(name, value)
getPropertyNames()
acknowledge()
clearBody()


Constructor Detail

MapMessage

MapMessage()

Method Detail

getByte

Number getByte(name)

getBytes

 getBytes(name)

getChar

String getChar(name)
    Returns:
      String representing the Unicode character of the specified name
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

getDouble

Number getDouble(name)
    Returns the Number representing the double value of the specified name.
    Parameters:
      name - the name of the Number
    Returns:
      Number double value with the specified name.
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

getFloat

Number getFloat(name)
    Returns the Number representing the float value of the specified name
    Parameters:
      name - the name of the Number
    Returns:
      Number float value with the specified name.
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

getLong

Number getLong(name)
    Returns the Number representing the long value of the specified name.

    NOTE: Javascript does not support 64 bit long integer natively. The maximum integer value supported by the Number type ranges from -9,007,199,254,740,992 (-2^53) to 9,007,199,254,740,992 (2^53).

    Parameters:
      name - the name of the Number
    Returns:
      Number long value with the specified name.
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

getMapNames

 getMapNames()
    Returns the array of names in the map message.
    Returns:
      the {Array} of names from the map message.
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

getObject

 getObject(name)
    Returns the object value of the specified name.
    Parameters:
      name - the name of the object value
    Returns:
      object value with the specified name.
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

getShort

Number getShort(name)
    Returns the Number representing the short value of the specified name
    Parameters:
      name - the name of the Number
    Returns:
      Number short value with the specified name.
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

getString

String getString(name)
    Returns the String value of the specified name
    Parameters:
      name - the name of the String
    Returns:
      String value with the specified name.
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

itemExists

Boolean itemExists(name)
    Returns the Boolean value indicating whether or not specified name exists on the map.
    Parameters:
      name - the name to check
    Returns:
      Boolean value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      MessageFormatException if this type conversion is invalid.

setBoolean

setBoolean(name, value)
    Sets the boolean value with the specified name
    Parameters:
      name - the name of the value
      value - {Boolean} value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setByte

setByte(name, value)
    Sets the Number representing the byte value with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - {Number} representing byte value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setBytes

setBytes(name, value, offset, length)
    Sets the byte array with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - byte array
      offset - {Number} offset the initial offset within the byte array
      length - {Number} len the number of bytes to use
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setBytes

setBytes(name, value, offset, length)
    Sets the byte array with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - byte array
      offset - {Number} offset the initial offset within the byte array
      length - {Number} len the number of bytes to use
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setChar

setChar(name, value)
    Sets the String representing the unicode character with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - {String} representing unicode character
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setDouble

setDouble(name, value)
    Sets the Number representing the double value with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - {Number} representing double value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setFloat

setFloat(name, value)
    Sets the Number representing the float value with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - {Number} representing float value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setInt

setInt(name, value)
    Sets the Number representing the integer value with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - {Number} representing integer value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setLong

setLong(name, value)
    Sets the Number representing the long value with the specified name in the map message. *

    NOTE: Javascript does not support 64 bit long integer natively. The maximum integer value supported by the Number type ranges from -9,007,199,254,740,992 (-2^53) to 9,007,199,254,740,992 (2^53).

    Parameters:
      name - the name of the value
      value - {Number} representing long value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setObject

setObject(name, value)
    Sets the object value with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - object
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setShort

setShort(name, value)
    Sets the Number representing the short value with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - {Number} representing short value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.

setString

setString(name, value)
    Sets the String value with the specified name in the map message.
    Parameters:
      name - the name of the value
      value - {String} value
    Throws:
      JMSException if the JMS provider fails to read the message due to some internal error.
      IllegalArgumentException if the name is null or if the name is an empty string.
      MessageNotWriteableException if the message is in read-only mode.