org.huihoo.jfox.ms.jms.message
Class MapMessageImpl

java.lang.Object
  extended byorg.huihoo.jfox.ms.jms.message.MessageImpl
      extended byorg.huihoo.jfox.ms.jms.message.MapMessageImpl
All Implemented Interfaces:
javax.jms.MapMessage, javax.jms.Message, java.io.Serializable

public class MapMessageImpl
extends MessageImpl
implements javax.jms.MapMessage, java.io.Serializable

Description: 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 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.

Version:
Revision: 1.1 Date: 2002-12-08 12:50:10
Author:
Peter.Cheng
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
MapMessageImpl()
          Default constructor.
 
Method Summary
 void clearBody()
          Clear out the message body.
 boolean getBoolean(java.lang.String name)
          Returns the boolean value with the specified name.
 byte getByte(java.lang.String name)
          Returns the byte value with the specified name.
 byte[] getBytes(java.lang.String name)
          Returns the byte array value with the specified name.
 char getChar(java.lang.String name)
          Returns the Unicode character value with the specified name.
 double getDouble(java.lang.String name)
          Returns the double value with the specified name.
 float getFloat(java.lang.String name)
          Returns the float value with the specified name.
 int getInt(java.lang.String name)
          Returns the int value with the specified name.
 long getLong(java.lang.String name)
          Returns the long value with the specified name.
 java.util.Enumeration getMapNames()
          Returns an Enumeration of all the names in the MapMessage object.
 java.lang.Object getObject(java.lang.String name)
          Returns the value of the object with the specified name.
 short getShort(java.lang.String name)
          Returns the short value with the specified name.
 java.lang.String getString(java.lang.String name)
          Returns the String value with the specified name.
 boolean itemExists(java.lang.String name)
          Indicates whether an item exists in this MapMessage object.
 void setBoolean(java.lang.String name, boolean value)
          Sets a boolean value with the specified name into the Map.
 void setByte(java.lang.String name, byte value)
          Sets a byte value with the specified name into the Map.
 void setBytes(java.lang.String name, byte[] value)
          Sets a byte array value with the specified name into the Map.
 void setBytes(java.lang.String name, byte[] value, int offset, int length)
          Sets a portion of the byte array value with the specified name into the Map.
 void setChar(java.lang.String name, char value)
          Sets a Unicode character value with the specified name into the Map.
 void setDouble(java.lang.String name, double value)
          Sets a double value with the specified name into the Map.
 void setFloat(java.lang.String name, float value)
          Sets a float value with the specified name into the Map.
 void setInt(java.lang.String name, int value)
          Sets an int value with the specified name into the Map.
 void setLong(java.lang.String name, long value)
          Sets a long value with the specified name into the Map.
 void setObject(java.lang.String name, java.lang.Object value)
          Sets an object value with the specified name into the Map.
 void setShort(java.lang.String name, short value)
          Sets a short value with the specified name into the Map.
 void setString(java.lang.String name, java.lang.String value)
          Sets a String value with the specified name into the Map.
 
Methods inherited from class org.huihoo.jfox.ms.jms.message.MessageImpl
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, isBodyModifiable, isPropertiesModifiable, propertyExists, setBodyModifiable, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setPropertiesModifiable, setShortProperty, setStringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.Message
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 

Constructor Detail

MapMessageImpl

public MapMessageImpl()
Default constructor.

Method Detail

getBoolean

public boolean getBoolean(java.lang.String name)
                   throws javax.jms.JMSException
Returns the boolean value with the specified name.

Specified by:
getBoolean in interface javax.jms.MapMessage
Parameters:
name - the name of the boolean
Returns:
the boolean value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getBoolean(String)

getByte

public byte getByte(java.lang.String name)
             throws javax.jms.JMSException
Returns the byte value with the specified name.

Specified by:
getByte in interface javax.jms.MapMessage
Parameters:
name - the name of the byte
Returns:
the byte value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getByte(String)

getShort

public short getShort(java.lang.String name)
               throws javax.jms.JMSException
Returns the short value with the specified name.

Specified by:
getShort in interface javax.jms.MapMessage
Parameters:
name - the name of the short
Returns:
the short value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getShort(String)

getChar

public char getChar(java.lang.String name)
             throws javax.jms.JMSException
Returns the Unicode character value with the specified name.

Specified by:
getChar in interface javax.jms.MapMessage
Parameters:
name - the name of the Unicode character
Returns:
the Unicode character value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getChar(String)

getInt

public int getInt(java.lang.String name)
           throws javax.jms.JMSException
Returns the int value with the specified name.

Specified by:
getInt in interface javax.jms.MapMessage
Parameters:
name - the name of the int
Returns:
the int value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getInt(String)

getLong

public long getLong(java.lang.String name)
             throws javax.jms.JMSException
Returns the long value with the specified name.

Specified by:
getLong in interface javax.jms.MapMessage
Parameters:
name - the name of the long
Returns:
the long value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getLong(String)

getFloat

public float getFloat(java.lang.String name)
               throws javax.jms.JMSException
Returns the float value with the specified name.

Specified by:
getFloat in interface javax.jms.MapMessage
Parameters:
name - the name of the float
Returns:
the float value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getFloat(String)

getDouble

public double getDouble(java.lang.String name)
                 throws javax.jms.JMSException
Returns the double value with the specified name.

Specified by:
getDouble in interface javax.jms.MapMessage
Parameters:
name - the name of the double
Returns:
the double value with the specified name
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getDouble(String)

getString

public java.lang.String getString(java.lang.String name)
                           throws javax.jms.JMSException
Returns the String value with the specified name.

Specified by:
getString in interface javax.jms.MapMessage
Parameters:
name - the name of the String
Returns:
the String value with the specified name; if there is no item by this name, a null value is returned
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getString(String)

getBytes

public byte[] getBytes(java.lang.String name)
                throws javax.jms.JMSException
Returns the byte array value with the specified name.

Specified by:
getBytes in interface javax.jms.MapMessage
Parameters:
name - the name of the byte array
Returns:
a copy of the byte array value with the specified name; if there is no item by this name, a null value is returned.
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
javax.jms.MessageFormatException - if this type conversion is invalid.
See Also:
MapMessage.getBytes(String)

getObject

public java.lang.Object getObject(java.lang.String name)
                           throws javax.jms.JMSException
Returns the value of the object with the specified name.

This method can be used to return, in objectified format, an object in the Java programming language ("Java object") that had been stored in the Map with the equivalent setObject method call, or its equivalent primitive set type method.

Note that byte values are returned as byte[], not Byte[].

Specified by:
getObject in interface javax.jms.MapMessage
Parameters:
name - the name of the Java object
Returns:
a copy of the Java object value with the specified name, in objectified format (for example, if the object was set as an int, an Integer is returned); if there is no item by this name, a null value is returned
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
See Also:
MapMessage.getObject(String)

getMapNames

public java.util.Enumeration getMapNames()
                                  throws javax.jms.JMSException
Returns an Enumeration of all the names in the MapMessage object.

Specified by:
getMapNames in interface javax.jms.MapMessage
Returns:
an enumeration of all the names in this MapMessage
Throws:
javax.jms.JMSException - if the JMS provider fails to read the message due to some internal error.
See Also:
MapMessage.getMapNames()

setBoolean

public void setBoolean(java.lang.String name,
                       boolean value)
                throws javax.jms.JMSException
Sets a boolean value with the specified name into the Map.

Specified by:
setBoolean in interface javax.jms.MapMessage
Parameters:
name - the name of the boolean
value - the boolean value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setBoolean(String, boolean)

setByte

public void setByte(java.lang.String name,
                    byte value)
             throws javax.jms.JMSException
Sets a byte value with the specified name into the Map.

Specified by:
setByte in interface javax.jms.MapMessage
Parameters:
name - the name of the byte
value - the byte value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setByte(String, byte)

setShort

public void setShort(java.lang.String name,
                     short value)
              throws javax.jms.JMSException
Sets a short value with the specified name into the Map.

Specified by:
setShort in interface javax.jms.MapMessage
Parameters:
name - the name of the short
value - the short value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setShort(String, short)

setChar

public void setChar(java.lang.String name,
                    char value)
             throws javax.jms.JMSException
Sets a Unicode character value with the specified name into the Map.

Specified by:
setChar in interface javax.jms.MapMessage
Parameters:
name - the name of the Unicode character
value - the Unicode character value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setChar(String, char)

setInt

public void setInt(java.lang.String name,
                   int value)
            throws javax.jms.JMSException
Sets an int value with the specified name into the Map.

Specified by:
setInt in interface javax.jms.MapMessage
Parameters:
name - the name of the int
value - the int value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setInt(String, int)

setLong

public void setLong(java.lang.String name,
                    long value)
             throws javax.jms.JMSException
Sets a long value with the specified name into the Map.

Specified by:
setLong in interface javax.jms.MapMessage
Parameters:
name - the name of the long
value - the long value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setLong(String, long)

setFloat

public void setFloat(java.lang.String name,
                     float value)
              throws javax.jms.JMSException
Sets a float value with the specified name into the Map.

Specified by:
setFloat in interface javax.jms.MapMessage
Parameters:
name - the name of the float
value - the float value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setFloat(String, float)

setDouble

public void setDouble(java.lang.String name,
                      double value)
               throws javax.jms.JMSException
Sets a double value with the specified name into the Map.

Specified by:
setDouble in interface javax.jms.MapMessage
Parameters:
name - the name of the double
value - the double value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setDouble(String, double)

setString

public void setString(java.lang.String name,
                      java.lang.String value)
               throws javax.jms.JMSException
Sets a String value with the specified name into the Map.

Specified by:
setString in interface javax.jms.MapMessage
Parameters:
name - the name of the String
value - the String value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setString(String, String)

setBytes

public void setBytes(java.lang.String name,
                     byte[] value)
              throws javax.jms.JMSException
Sets a byte array value with the specified name into the Map.

Specified by:
setBytes in interface javax.jms.MapMessage
Parameters:
name - the name of the byte array
value - the byte array value to set in the Map; the array is copied so that the value for name will not be altered by future modifications
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setBytes(String, byte[])

setBytes

public void setBytes(java.lang.String name,
                     byte[] value,
                     int offset,
                     int length)
              throws javax.jms.JMSException
Sets a portion of the byte array value with the specified name into the Map.

Specified by:
setBytes in interface javax.jms.MapMessage
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 use
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setBytes(String, byte[], int, int)

setObject

public void setObject(java.lang.String name,
                      java.lang.Object value)
               throws javax.jms.JMSException
Sets an object value with the specified name into the Map.

This method works only for the objectified primitive object types ( Integer,Double,Long  ...), String objects, and byte arrays.

Specified by:
setObject in interface javax.jms.MapMessage
Parameters:
name - the name of the Java object
value - the Java object value to set in the Map
Throws:
javax.jms.JMSException - if the JMS provider fails to write the message due to some internal error.
javax.jms.MessageFormatException - if the object is invalid.
javax.jms.MessageNotWriteableException - if the message is in read-only mode.
See Also:
MapMessage.setObject(String, Object)

itemExists

public boolean itemExists(java.lang.String name)
                   throws javax.jms.JMSException
Indicates whether an item exists in this MapMessage object.

Specified by:
itemExists in interface javax.jms.MapMessage
Parameters:
name - the name of the item to test
Returns:
true if the item exists
Throws:
javax.jms.JMSException - if the JMS provider fails to determine if the item exists due to some internal error.
See Also:
MapMessage.itemExists(String)

clearBody

public void clearBody()
               throws javax.jms.JMSException
Clear out the message body.

Specified by:
clearBody in interface javax.jms.Message
Overrides:
clearBody in class MessageImpl
Throws:
javax.jms.JMSException


Copyright © 2002-2003 Open Enterprise Foundation. All Rights Reserved.