public class WrappingTextMessage extends DelegateMessage implements TextMessage
DEFAULT_DELIVERY_DELAY, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
Constructor and Description |
---|
WrappingTextMessage(TextMessage message) |
Modifier and Type | Method and Description |
---|---|
<T> T |
getBody(java.lang.Class<T> c)
Returns the message body as an object of the specified type.
|
java.lang.String |
getText()
Gets the string containing this message's data.
|
boolean |
isBodyAssignableTo(java.lang.Class c)
Returns whether the message body is capable of being assigned to the specified type.
|
void |
setText(java.lang.String string)
Sets the string containing this message's data.
|
acknowledge, clearBody, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
acknowledge, clearBody, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDeliveryTime, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDeliveryTime, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
public WrappingTextMessage(TextMessage message)
public boolean isBodyAssignableTo(java.lang.Class c) throws JMSException
Message
getBody
on the same message with the same type argument would not throw a
MessageFormatException.
If the message is a StreamMessage
then false is always returned. If the message is a ObjectMessage
and object deserialization fails then false is returned. If the message has no body then any type may be specified
and true is returned.
isBodyAssignableTo
in interface Message
isBodyAssignableTo
in class DelegateMessage
c
- The specified type TextMessage
then this method will only return true if this parameter is set to
String.class
or another type to which a String
is assignable. ObjectMessage
then this method will only return true if this parameter is set to
java.io.Serializable.class
or another class to which the body is assignable. MapMessage
then this method will only return true if this parameter is set to
java.util.Map.class
(or java.lang.Object.class
). BytesMessage
then this this method will only return true if this parameter is set to
byte[].class
(or java.lang.Object.class
). TextMessage
, ObjectMessage
, MapMessage
or BytesMessage
and the
message has no body, then the above does not apply and this method will return true irrespective of the value of this
parameter.Message
(but not one of its subtypes) then this method will return true irrespective of
the value of this parameter.JMSException
- if the JMS provider fails to return a value due to some internal error.public <T> T getBody(java.lang.Class<T> c) throws JMSException
Message
getBody
in interface Message
getBody
in class DelegateMessage
T
- The type of the message bodyc
- The type to which the message body will be assigned. TextMessage
then this parameter must be set to String.class
or another type to
which a String
is assignable. ObjectMessage
then parameter must must be set to java.io.Serializable.class
or
another type to which the body is assignable. MapMessage
then this parameter must be set to java.util.Map.class
(or
java.lang.Object.class
). BytesMessage
then this parameter must be set to byte[].class
(or
java.lang.Object.class
). This method will reset the BytesMessage
before and after use.TextMessage
, ObjectMessage
, MapMessage
or BytesMessage
and the
message has no body, then the above does not apply and this parameter may be set to any type; the returned value will
always be null.Message
(but not one of its subtypes) then this parameter may be set to any type; the
returned value will always be null.MessageFormatException
- StreamMessage
ObjectMessage
and object deserialization fails.
JMSException
- if the JMS provider fails to get the message body due to some internal error.public java.lang.String getText() throws JMSException
TextMessage
getText
in interface TextMessage
String
containing the message's dataJMSException
- if the JMS provider fails to get the text due to some internal error.public void setText(java.lang.String string) throws JMSException
TextMessage
setText
in interface TextMessage
string
- the String
containing the message's dataJMSException
- if the JMS provider fails to set the text due to some internal error.MessageNotWriteableException
- if the message is in read-only mode.