org.springframework.messaging.support

Class AbstractHeaderMapper<T>

  • java.lang.Object
    • org.springframework.messaging.support.AbstractHeaderMapper<T>
  • Type Parameters:
    T - type of the instance to and from which headers will be mapped
    All Implemented Interfaces:
    HeaderMapper<T>
    Direct Known Subclasses:
    SimpleJmsHeaderMapper


    public abstract class AbstractHeaderMapper<T>
    extends java.lang.Object
    implements HeaderMapper<T>
    A base HeaderMapper implementation.
    Since:
    4.1
    Author:
    Stephane Nicoll
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected Log logger 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected java.lang.String fromHeaderName(java.lang.String headerName)
      Generate the name to use to set the header defined by the specified headerName to the protocol specific message.
      protected <V> V getHeaderIfAvailable(java.util.Map<java.lang.String,java.lang.Object> headers, java.lang.String name, java.lang.Class<V> type)
      Return the header value, or null if it does not exist or does not match the requested type.
      void setInboundPrefix(java.lang.String inboundPrefix)
      Specify a prefix to be appended to the message header name for any user-defined property that is being mapped into the MessageHeaders.
      void setOutboundPrefix(java.lang.String outboundPrefix)
      Specify a prefix to be appended to the protocol property name for any user-defined message header that is being mapped into the protocol-specific Message.
      protected java.lang.String toHeaderName(java.lang.String propertyName)
      Generate the name to use to set the header defined by the specified propertyName to the MessageHeaders instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        protected final Log logger
    • Constructor Detail

      • AbstractHeaderMapper

        public AbstractHeaderMapper()
    • Method Detail

      • setInboundPrefix

        public void setInboundPrefix(@Nullable
                                     java.lang.String inboundPrefix)
        Specify a prefix to be appended to the message header name for any user-defined property that is being mapped into the MessageHeaders. The default is an empty String (no prefix).
      • setOutboundPrefix

        public void setOutboundPrefix(@Nullable
                                      java.lang.String outboundPrefix)
        Specify a prefix to be appended to the protocol property name for any user-defined message header that is being mapped into the protocol-specific Message. The default is an empty String (no prefix).
      • fromHeaderName

        protected java.lang.String fromHeaderName(java.lang.String headerName)
        Generate the name to use to set the header defined by the specified headerName to the protocol specific message.
        See Also:
        setOutboundPrefix(java.lang.String)
      • toHeaderName

        protected java.lang.String toHeaderName(java.lang.String propertyName)
        Generate the name to use to set the header defined by the specified propertyName to the MessageHeaders instance.
        See Also:
        setInboundPrefix(String)
      • getHeaderIfAvailable

        @Nullable
        protected <V> V getHeaderIfAvailable(java.util.Map<java.lang.String,java.lang.Object> headers,
                                                       java.lang.String name,
                                                       java.lang.Class<V> type)
        Return the header value, or null if it does not exist or does not match the requested type.