MapMessage


public interface MapMessage
extends Message

WebSphere MQ class: JMSMapMessage



java.lang.Object
   |
   +----com.ibm.jms.JMSMessage
           |
           +----com.ibm.jms.JMSMapMessage

A MapMessage is used to send a set of name-value pairs where names are Strings and values are Java primitive types. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined.

See also: BytesMessage, Message, ObjectMessage, StreamMessage, and TextMessage

Methods

getBoolean
public boolean getBoolean(java.lang.String name)
                                             throws JMSException

Return the boolean value with the given name.

Parameters:
name - the name of the boolean

Returns:
the boolean value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getByte
public byte getByte(java.lang.String name)
                                     throws JMSException

Return the byte value with the given name.

Parameters:
name - the name of the byte.

Returns:
the byte value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getBytes
public byte[] getBytes(java.lang.String name) throws JMSException

Return the byte array value with the given name.

Parameters:
name - the name of the byte array.

Returns:
a copy of the byte array value with the given name. If there is no item by this name, a null value is returned.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getChar
public char getChar(java.lang.String name)
                                       throws JMSException

Return the Unicode character value with the given name.

Parameters:
name - the name of the Unicode character.

Returns:
the Unicode character value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getDouble
public double getDouble(java.lang.String name) throws JMSException

Return the double value with the given name.

Parameters:
name - the name of the double.

Returns:
the double value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getFloat
public float getFloat(java.lang.String name) throws JMSException

Return the float value with the given name.

Parameters:
name - the name of the float.

Returns:
the float value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getInt
public int getInt(java.lang.String name)
                                             throws JMSException

Return the integer value with the given name.

Parameters:
name - the name of the integer.

Returns:
the integer value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getLong
public long getLong(java.lang.String name)
                                           throws JMSException

Return the long value with the given name.

Parameters:
name - the name of the long.

Returns:
the long value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getMapNames
public java.util.Enumeration getMapNames() throws JMSException

Return an Enumeration of all the Map message's names.

Returns:
an enumeration of all the names in this Map message.

Throws:
JMSException - if JMS fails to read the message because of an internal JMS error.

getObject
public java.lang.Object getObject(java.lang.String name)
                                    throws JMSException

Return the Java object value with the given name. This method returns in object format, a value that has been stored in the Map either using the setObject method call, or the equivalent primitive set method.

Parameters:
name - the name of the Java object.

Returns:
a copy of the Java object value with the given name, in object format (if it is set as an int, then a Integer is returned). If there is no item by this name, a null value is returned.

Throws:
JMSException - if JMS fails to read the message because of an internal JMS error.

getShort
public short getShort(java.lang.String name) throws JMSException

Return the short value with the given name.

Parameters:
name - the name of the short.

Returns:
the short value with the given name.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

getString
public java.lang.String getString(java.lang.String name)
                                             throws JMSException

Return the String value with the given name.

Parameters:
name - the name of the String.

Returns:
the String value with the given name. If there is no item by this name, a null value is returned.

Throws:
  • JMSException - if JMS fails to read the message because of an internal JMS error.
  • MessageFormatException - if this type conversion is not valid.

itemExists
public boolean itemExists(java.lang.String name)
                                     throws JMSException

Check if an item exists in this MapMessage.

Parameters:
name - the name of the item to test.

Returns:
true if the item does exist.

Throws:
JMSException - if a JMS error occurs.

setBoolean
public void setBoolean(java.lang.String name,
                       boolean value) throws JMSException

Set a boolean value with the given name into the Map.

Parameters:
  • name - the name of the boolean.
  • value - the boolean value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setByte
public void setByte(java.lang.String name,
                    byte value) throws JMSException

Set a byte value with the given name into the Map.

Parameters:
  • name - the name of the byte.
  • value - the byte value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error
  • MessageNotWriteableException - if the message is in read-only mode.

setBytes
public void setBytes(java.lang.String name,
                     byte[] value) throws JMSException

Set a byte array value with the given name into the Map.

Parameters:
  • name - the name of the byte array.
  • value - the byte array value to set in the Map.

    The array is copied, so the value in the map is not altered by subsequent modifications to the array.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setBytes
public void setBytes(java.lang.String name,
                     byte[] value,
                     int offset,
                     int length) throws JMSException

Set a portion of the byte array value with the given name into the Map.

The array is copied, so the value in the map is not altered by subsequent modifications to the array.

Parameters:
  • name - the name of the byte array.
  • value - the byte array value to set in the Map.
  • offset - the initial offset within the byte array.
  • length - the number of bytes to be copied.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setChar
public void setChar(java.lang.String name,
                    char value) throws JMSException

Set a Unicode character value with the given name into the Map.

Parameters:
  • name - the name of the Unicode character.
  • value - the Unicode character value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setDouble
public void setDouble(java.lang.String name,
                      double value) throws JMSException

Set a double value with the given name into the Map.

Parameters:
  • name - the name of the double.
  • value - the double value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setFloat
public void setFloat(java.lang.String name,
                     float value) throws JMSException

Set a float value with the given name into the Map.

Parameters:
  • name - the name of the float.
  • value - the float value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setInt
public void setInt(java.lang.String name,
                   int value) throws JMSException

Set an integer value with the given name into the Map.

Parameters:
  • name - the name of the integer.
  • value - the integer value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setLong
public void setLong(java.lang.String name,
                    long value) throws JMSException

Set a long value with the given name into the Map.

Parameters:
  • name - the name of the long.
  • value - the long value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setObject
public void setObject(java.lang.String name,
                      java.lang.Object value) throws JMSException

Set a Java object value with the given name into the Map. This method only works for object primitive types (Integer, Double, Long, for example), Strings and byte arrays.

Parameters:
  • name - the name of the Java object.
  • value - the Java object value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageFormatException - if object is not valid.
  • MessageNotWriteableException - if the message is in read-only mode.

setShort
public void setShort(java.lang.String name,
                     short value) throws JMSException

Set a short value with the given name into the Map.

Parameters:
  • name - the name of the short.
  • value - the short value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.

setString
public void setString(java.lang.String name,
                      java.lang.String value) throws JMSException

Set a String value with the given name into the Map.

Parameters:
  • name - the name of the String.
  • value - the String value to set in the Map.

Throws:
  • JMSException - if JMS fails to write message due to some internal JMS error.
  • MessageNotWriteableException - if the message is in read-only mode.



© IBM Corporation 1997, 2002. All Rights Reserved