public class MarshallingMessageConverter extends ObjectSE implements MessageConverter, InitializingBean
Marshaller および Unmarshaller を使用する Spring JMS MessageConverter。オブジェクトを BytesMessageEE または targetType が MessageType.TEXT に設定されている場合は TextMessageEE にマーシャリングします。TextMessageEE または BytesMessageEE からオブジェクトへの非整列化。| コンストラクターと説明 |
|---|
MarshallingMessageConverter() |
MarshallingMessageConverter(Marshaller marshaller) 指定された Marshaller セットで新しい MarshallingMessageConverter を構築します。 |
MarshallingMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller) 指定された Marshaller と Unmarshaller で新しい MarshallingMessageConverter を構築します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | afterPropertiesSet() |
ObjectSE | fromMessage(MessageEE message) この実装は、指定された MessageEE をオブジェクトに非整列化します。 |
protected BytesMessageEE | marshalToBytesMessage(ObjectSE object, SessionEE session, Marshaller marshaller) 指定されたオブジェクトを BytesMessageEE にマーシャリングします。 |
protected MessageEE | marshalToMessage(ObjectSE object, SessionEE session, Marshaller marshaller, MessageType targetType) カスタムメッセージマーシャリングを可能にするテンプレートメソッド。 |
protected TextMessageEE | marshalToTextMessage(ObjectSE object, SessionEE session, Marshaller marshaller) 指定されたオブジェクトを TextMessageEE にマーシャリングします。 |
void | setMarshaller(Marshaller marshaller) このメッセージコンバーターで使用する Marshaller を設定します。 |
void | setTargetType(MessageType targetType) |
void | setUnmarshaller(Unmarshaller unmarshaller) このメッセージコンバーターで使用する Unmarshaller を設定します。 |
MessageEE | toMessage(ObjectSE object, SessionEE session) この実装は、指定されたオブジェクトを TextMessageEE または BytesMessageEE にマーシャリングします。 |
protected ObjectSE | unmarshalFromBytesMessage(BytesMessageEE message, Unmarshaller unmarshaller) 指定された BytesMessageEE をオブジェクトに非整列化します。 |
protected ObjectSE | unmarshalFromMessage(MessageEE message, Unmarshaller unmarshaller) カスタムメッセージの非整列化を可能にするテンプレートメソッド。 |
protected ObjectSE | unmarshalFromTextMessage(TextMessageEE message, Unmarshaller unmarshaller) 指定された TextMessageEE をオブジェクトに非整列化します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic MarshallingMessageConverter()
Marshaller または Unmarshaller が設定されていない新しい MarshallingMessageConverter を構築します。マーシャラーは、構築後に setMarshaller(Marshaller) および setUnmarshaller(Unmarshaller) を呼び出して設定する必要があります。public MarshallingMessageConverter(Marshaller marshaller)
Marshaller セットで新しい MarshallingMessageConverter を構築します。 指定された Marshaller が Unmarshaller インターフェースも実装している場合、マーシャリングとアンマーシャリングの両方に使用されます。そうでない場合、例外がスローされます。
Spring のすべての Marshaller 実装も Unmarshaller インターフェースを実装するため、このコンストラクターを安全に使用できることに注意してください。
marshaller - マーシャラーおよびアンマーシャラーとして使用されるオブジェクト IllegalArgumentExceptionSE - marshaller が Unmarshaller インターフェースも実装していない場合 public MarshallingMessageConverter(Marshaller marshaller, Unmarshaller unmarshaller)
MarshallingMessageConverter を構築します。marshaller - 使用するマーシャラー unmarshaller - 使用するアンマーシャラー public void setMarshaller(Marshaller marshaller)
Marshaller を設定します。public void setUnmarshaller(Unmarshaller unmarshaller)
Unmarshaller を設定します。public void setTargetType(MessageType targetType)
toMessage(Object, Session) が BytesMessageEE または TextMessageEE にマーシャリングするかどうかを指定します。 デフォルトは MessageType.BYTES です。つまり、このコンバーターは BytesMessageEE にマーシャリングします。このコンバーターのデフォルトバージョンは MessageType.BYTES および MessageType.TEXT のみをサポートすることに注意してください。
public void afterPropertiesSet()
InitializingBeanBeanFactoryAware、ApplicationContextAware などを満たした後、包含 BeanFactory によって呼び出されます。このメソッドにより、Bean インスタンスは、すべての Bean プロパティが設定されたときに、その全体的な構成の検証と最終的な初期化を実行できます。
InitializingBean の afterPropertiesSet public MessageEE toMessage(ObjectSE object, SessionEE session) throws JMSExceptionEE, MessageConversionException
TextMessageEE または BytesMessageEE にマーシャリングします。目的のメッセージ型は、"marshalTo" プロパティを設定することで定義できます。MessageConverter の toMessage object - 変換するオブジェクト session - JMS メッセージの作成に使用するセッション JMSExceptionEE - JMS API メソッドによってスローされた場合 MessageConversionException - 変換に失敗した場合 marshalToTextMessage(java.lang.Object, javax.jms.Session, org.springframework.oxm.Marshaller), marshalToBytesMessage(java.lang.Object, javax.jms.Session, org.springframework.oxm.Marshaller)public ObjectSE fromMessage(MessageEE message) throws JMSExceptionEE, MessageConversionException
MessageEE をオブジェクトに非整列化します。MessageConverter の fromMessage message - 変換するメッセージ JMSExceptionEE - JMS API メソッドによってスローされた場合 MessageConversionException - 変換に失敗した場合 unmarshalFromTextMessage(javax.jms.TextMessage, org.springframework.oxm.Unmarshaller), unmarshalFromBytesMessage(javax.jms.BytesMessage, org.springframework.oxm.Unmarshaller)protected TextMessageEE marshalToTextMessage(ObjectSE object, SessionEE session, Marshaller marshaller) throws JMSExceptionEE, IOExceptionSE, XmlMappingException
TextMessageEE にマーシャリングします。object - 整列化されるオブジェクト session - 現在の JMS セッション marshaller - 使用するマーシャラー JMSExceptionEE - JMS メソッドによってスローされた場合 IOExceptionSE - I/O エラーの場合 XmlMappingException - OXM マッピングエラーの場合 Session.createTextMessage()EE, Marshaller.marshal(Object, Result)protected BytesMessageEE marshalToBytesMessage(ObjectSE object, SessionEE session, Marshaller marshaller) throws JMSExceptionEE, IOExceptionSE, XmlMappingException
BytesMessageEE にマーシャリングします。object - 整列化されるオブジェクト session - 現在の JMS セッション marshaller - 使用するマーシャラー JMSExceptionEE - JMS メソッドによってスローされた場合 IOExceptionSE - I/O エラーの場合 XmlMappingException - OXM マッピングエラーの場合 Session.createBytesMessage()EE, Marshaller.marshal(Object, Result)protected MessageEE marshalToMessage(ObjectSE object, SessionEE session, Marshaller marshaller, MessageType targetType) throws JMSExceptionEE, IOExceptionSE, XmlMappingException
setTargetType(org.springframework.jms.support.converter.MessageType) が MessageType.TEXT または MessageType.BYTES でない場合に呼び出されます。 デフォルトの実装は IllegalArgumentExceptionSE をスローします。
object - マーシャリングするオブジェクト session - JMS セッション marshaller - 使用するマーシャラー targetType - ターゲットメッセージ型 (TEXT または BYTES 以外)JMSExceptionEE - JMS メソッドによってスローされた場合 IOExceptionSE - I/O エラーの場合 XmlMappingException - OXM マッピングエラーの場合 protected ObjectSE unmarshalFromTextMessage(TextMessageEE message, Unmarshaller unmarshaller) throws JMSExceptionEE, IOExceptionSE, XmlMappingException
TextMessageEE をオブジェクトに非整列化します。message - メッセージ unmarshaller - 使用するアンマーシャラー JMSExceptionEE - JMS メソッドによってスローされた場合 IOExceptionSE - I/O エラーの場合 XmlMappingException - OXM マッピングエラーの場合 Unmarshaller.unmarshal(Source)protected ObjectSE unmarshalFromBytesMessage(BytesMessageEE message, Unmarshaller unmarshaller) throws JMSExceptionEE, IOExceptionSE, XmlMappingException
BytesMessageEE をオブジェクトに非整列化します。message - メッセージ unmarshaller - 使用するアンマーシャラー JMSExceptionEE - JMS メソッドによってスローされた場合 IOExceptionSE - I/O エラーの場合 XmlMappingException - OXM マッピングエラーの場合 Unmarshaller.unmarshal(Source)protected ObjectSE unmarshalFromMessage(MessageEE message, Unmarshaller unmarshaller) throws JMSExceptionEE, IOExceptionSE, XmlMappingException
TextMessageEE または BytesMessageEE 以外のメッセージで fromMessage(Message) が呼び出されると呼び出されます。 デフォルトの実装は IllegalArgumentExceptionSE をスローします。
message - メッセージ unmarshaller - 使用するアンマーシャラー JMSExceptionEE - JMS メソッドによってスローされた場合 IOExceptionSE - I/O エラーの場合 XmlMappingException - OXM マッピングエラーの場合