org.springframework.jms.support

## Class SimpleJmsHeaderMapper

- java.lang.Object
- - org.springframework.messaging.support.AbstractHeaderMapper<Message>
  - - org.springframework.jms.support.SimpleJmsHeaderMapper

All Implemented Interfaces:
  JmsHeaderMapper, org.springframework.messaging.support.HeaderMapper<Message>

    public class SimpleJmsHeaderMapper
    extends org.springframework.messaging.support.AbstractHeaderMapper<Message>
    implements JmsHeaderMapper

Simple implementation of `JmsHeaderMapper`.

This implementation copies JMS API headers (e.g. JMSReplyTo) to and from `Messages`. Any user-defined properties will also be copied from a JMS Message to a Message, and any other headers on a Message (beyond the JMS API headers) will likewise be copied to a JMS Message. Those other headers will be copied to the general properties of a JMS Message whereas the JMS API headers are passed to the appropriate setter methods (e.g. setJMSReplyTo).

Constants for the JMS API headers are defined in `JmsHeaders`. Note that most of the JMS headers are read-only: the JMSDestination, JMSDeliveryMode, JMSExpiration, JMSMessageID, JMSPriority, JMSRedelivered and JMSTimestamp flags are only copied from a JMS Message. Those values will not be passed along from a Message to an outbound JMS Message.

Since:
  4.1
Author:
  Mark Fisher, Gary Russell, Stephane Nicoll

### Field Summary

### Fields inherited from class org.springframework.messaging.support.AbstractHeaderMapper

`logger`

### Fields inherited from interface org.springframework.jms.support.JmsHeaderMapper

`CONTENT_TYPE_PROPERTY`

### Constructor Summary

Constructors
Constructor and Description
`SimpleJmsHeaderMapper()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected String` `fromHeaderName(String headerName)` Add the outbound prefix if necessary.
`void` `fromHeaders(org.springframework.messaging.MessageHeaders headers, Message jmsMessage)`
`protected String` `toHeaderName(String propertyName)` Add the inbound prefix if necessary.
`org.springframework.messaging.MessageHeaders` `toHeaders(Message jmsMessage)`

### Methods inherited from class org.springframework.messaging.support.AbstractHeaderMapper

`getHeaderIfAvailable, setInboundPrefix, setOutboundPrefix`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SimpleJmsHeaderMapper

    public SimpleJmsHeaderMapper()

### Method Detail

#### fromHeaders

    public void fromHeaders(org.springframework.messaging.MessageHeaders headers,
                            Message jmsMessage)

Specified by:
  `fromHeaders` in interface `org.springframework.messaging.support.HeaderMapper<Message>`

#### toHeaders

    public org.springframework.messaging.MessageHeaders toHeaders(Message jmsMessage)

Specified by:
  `toHeaders` in interface `org.springframework.messaging.support.HeaderMapper<Message>`

#### fromHeaderName

    protected String fromHeaderName(String headerName)

Add the outbound prefix if necessary.

Convert `MessageHeaders.CONTENT_TYPE` to `content_type` for JMS compliance.

Overrides:
  `fromHeaderName` in class `org.springframework.messaging.support.AbstractHeaderMapper<Message>`
See Also:
  `JmsHeaderMapper.CONTENT_TYPE_PROPERTY`

#### toHeaderName

    protected String toHeaderName(String propertyName)

Add the inbound prefix if necessary.

Convert the JMS-compliant `content_type` to `MessageHeaders.CONTENT_TYPE`.

Overrides:
  `toHeaderName` in class `org.springframework.messaging.support.AbstractHeaderMapper<Message>`
See Also:
  `JmsHeaderMapper.CONTENT_TYPE_PROPERTY`