/** * This implementation marshals the given object to a {@link javax.jms.TextMessage} or * {@link javax.jms.BytesMessage}. The desired message type can be defined by setting * the {@link #setTargetType "marshalTo"} property. * @see #marshalToTextMessage * @see #marshalToBytesMessage */ @Override public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException { Assert.state(this.marshaller != null, "No Marshaller set"); try { switch (this.targetType) { case TEXT: return marshalToTextMessage(object, session, this.marshaller); case BYTES: return marshalToBytesMessage(object, session, this.marshaller); default: return marshalToMessage(object, session, this.marshaller, this.targetType); } } catch (XmlMappingException | IOException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } }
/** * This implementation marshals the given object to a {@link javax.jms.TextMessage} or * {@link javax.jms.BytesMessage}. The desired message type can be defined by setting * the {@link #setTargetType "marshalTo"} property. * @see #marshalToTextMessage * @see #marshalToBytesMessage */ @Override public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException { Assert.state(this.marshaller != null, "No Marshaller set"); try { switch (this.targetType) { case TEXT: return marshalToTextMessage(object, session, this.marshaller); case BYTES: return marshalToBytesMessage(object, session, this.marshaller); default: return marshalToMessage(object, session, this.marshaller, this.targetType); } } catch (XmlMappingException | IOException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } }
/** * This implementation marshals the given object to a {@link javax.jms.TextMessage} or * {@link javax.jms.BytesMessage}. The desired message type can be defined by setting * the {@link #setTargetType "marshalTo"} property. * @see #marshalToTextMessage * @see #marshalToBytesMessage */ public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException { try { switch (this.targetType) { case TEXT: return marshalToTextMessage(object, session, this.marshaller); case BYTES: return marshalToBytesMessage(object, session, this.marshaller); default: return marshalToMessage(object, session, this.marshaller, this.targetType); } } catch (XmlMappingException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } catch (IOException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } }
/** * This implementation marshals the given object to a {@link javax.jms.TextMessage} or * {@link javax.jms.BytesMessage}. The desired message type can be defined by setting * the {@link #setTargetType "marshalTo"} property. * @see #marshalToTextMessage * @see #marshalToBytesMessage */ @Override public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException { try { switch (this.targetType) { case TEXT: return marshalToTextMessage(object, session, this.marshaller); case BYTES: return marshalToBytesMessage(object, session, this.marshaller); default: return marshalToMessage(object, session, this.marshaller, this.targetType); } } catch (XmlMappingException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } catch (IOException ex) { throw new MessageConversionException("Could not marshal [" + object + "]", ex); } }