1 6 7 package org.jfox.jms.message; 8 9 import javax.jms.JMSException ; 10 import javax.jms.MessageNotWriteableException ; 11 import javax.jms.TextMessage ; 12 13 23 24 public class TextMessageImpl extends JMSMessage implements TextMessage { 25 26 private String text = null; 27 28 31 public TextMessageImpl() { 32 super(); 33 } 34 35 43 public void setText(String string) throws JMSException { 44 if (isBodyModifiable()) { 45 text = new String (string); 46 } else { 47 throw new MessageNotWriteableException ("TextMessage is read-only."); 48 } 49 } 50 51 57 public String getText() throws JMSException { 58 return text; 59 } 60 61 66 public void clearBody() throws JMSException { 67 super.clearBody(); 68 text = null; 69 } 70 71 public String toString() { 72 return "TextMessage {body=" + text + "}"; 73 } 74 } 75 | Popular Tags |