Spring AMQP

org.springframework.amqp.support.converter
Class JsonMessageConverter

java.lang.Object
  extended by org.springframework.amqp.support.converter.JsonMessageConverter
All Implemented Interfaces:
MessageConverter

public class JsonMessageConverter
extends Object
implements MessageConverter

JSON converter that uses the Jackson Json library.

Author:
Mark Pollack

Field Summary
static String DEFAULT_CHARSET
           
 
Constructor Summary
JsonMessageConverter()
           
 
Method Summary
 Object fromMessage(Message message)
          Convert from a Rabbit GetResponse to a Java object.
 ClassMapper getClassMapper()
           
protected  void initializeJsonObjectMapper()
          Subclass and override to customize.
 void setClassMapper(ClassMapper classMapper)
           
 void setDefaultCharset(String defaultCharset)
          Specify the default charset to use when converting to or from text-based Message body content.
 Message toMessage(Object objectToConvert, MessageProperties messageProperties)
          Convert a Java object to a Rabbit Message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHARSET

public static final String DEFAULT_CHARSET
See Also:
Constant Field Values
Constructor Detail

JsonMessageConverter

public JsonMessageConverter()
Method Detail

setDefaultCharset

public void setDefaultCharset(String defaultCharset)
Specify the default charset to use when converting to or from text-based Message body content. If not specified, the charset will be "UTF-8".


getClassMapper

public ClassMapper getClassMapper()

setClassMapper

public void setClassMapper(ClassMapper classMapper)

initializeJsonObjectMapper

protected void initializeJsonObjectMapper()
Subclass and override to customize.


fromMessage

public Object fromMessage(Message message)
                   throws MessageConversionException
Description copied from interface: MessageConverter
Convert from a Rabbit GetResponse to a Java object.

Specified by:
fromMessage in interface MessageConverter
Parameters:
message - the message to convert
Returns:
the converted Java object
Throws:
MessageConversionException - in case of conversion failure

toMessage

public Message toMessage(Object objectToConvert,
                         MessageProperties messageProperties)
                  throws MessageConversionException
Description copied from interface: MessageConverter
Convert a Java object to a Rabbit Message.

Specified by:
toMessage in interface MessageConverter
Parameters:
objectToConvert - the object to convert
Returns:
the Rabbit Message
Throws:
MessageConversionException - in case of conversion failure

Spring AMQP

Copyright © 2010. All Rights Reserved.