public class DefaultClassMapper extends Object implements ClassMapper, InitializingBean
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.
setIdClassMapping(Map) can be used to map tokens in the
"__TypeId__" header to classes. If this class is not a
Spring-managed bean, call afterPropertiesSet() to set up the class to id
mapping.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CLASSID_FIELD_NAME |
| Constructor and Description |
|---|
DefaultClassMapper()
Construct an instance that trusts all packages.
|
DefaultClassMapper(String... trustedPackages)
Construct an instance that trusts certain packages, "*" means all.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
fromClass(Class<?> clazz,
MessageProperties properties) |
String |
getClassIdFieldName() |
void |
setDefaultHashtableClass(Class<?> defaultHashtableClass) |
void |
setDefaultType(Class<?> defaultType)
The type returned by
toClass(MessageProperties) if no type information
is found in the message properties. |
void |
setIdClassMapping(Map<String,Class<?>> idClassMapping) |
Class<?> |
toClass(MessageProperties properties) |
public static final String DEFAULT_CLASSID_FIELD_NAME
public DefaultClassMapper()
public DefaultClassMapper(String... trustedPackages)
trustedPackages - the packages to trust.public void setDefaultType(Class<?> defaultType)
toClass(MessageProperties) if no type information
is found in the message properties.defaultType - the defaultType to setpublic void setDefaultHashtableClass(Class<?> defaultHashtableClass)
public String getClassIdFieldName()
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanExceptionpublic void fromClass(Class<?> clazz, MessageProperties properties)
fromClass in interface ClassMapperpublic Class<?> toClass(MessageProperties properties)
toClass in interface ClassMapper