org.springframework.amqp.support.converter
Class DefaultClassMapper
java.lang.Object
org.springframework.amqp.support.converter.DefaultClassMapper
- All Implemented Interfaces:
- ClassMapper, InitializingBean
public class DefaultClassMapper
- extends Object
- implements ClassMapper, InitializingBean
Maps to/from JSON using type information in the MessageProperties
;
the default name of the message property containing the type is '__TypeId__'.
An optional property setDefaultType(Class)
is provided that allows mapping to a statically defined type, if no message property is
found in the message properties.
- Author:
- Mark Pollack, Gary Russell
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_CLASSID_FIELD_NAME
public static final String DEFAULT_CLASSID_FIELD_NAME
- See Also:
- Constant Field Values
DefaultClassMapper
public DefaultClassMapper()
setDefaultType
public void setDefaultType(Class<?> defaultType)
- The type returned by
toClass(MessageProperties)
if no type information
is found in the message properties.
- Parameters:
defaultType
- the defaultType to set
setDefaultHashtableClass
public void setDefaultHashtableClass(Class<?> defaultHashtableClass)
getClassIdFieldName
public String getClassIdFieldName()
setIdClassMapping
public void setIdClassMapping(Map<String,Class<?>> idClassMapping)
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet
in interface InitializingBean
- Throws:
Exception
fromClass
public void fromClass(Class<?> clazz,
MessageProperties properties)
- Specified by:
fromClass
in interface ClassMapper
toClass
public Class<?> toClass(MessageProperties properties)
- Specified by:
toClass
in interface ClassMapper