Jörg Schaible edited a comment on Improvement XSTR-578

Actually this issue is not completely resolved, because alias support for the converter is not out-of-the box.

XStream normally has no to separate between a primitive and its boxed type. The complete reflection API works always with the boxed types and converts to primitives types on the fly. However, for method and field type signatures the difference is essential. Nevertheless it is possible to register derived versions of the converters that are able to respect the aliasing with some minor effort. Following lines are taken from the AliasTest in the acceptence tests:

XStream xstream = new XStream();
Mapper mapper = new MapperWrapper(xstream.getMapper().lookupMapperOfType(ArrayMapper.class)) {
  public Class realClass(String elementName) {
    Class primitiveType = Primitives.primitiveType(elementName);
    return primitiveType != null ? primitiveType : super.realClass(elementName);
  }
};
SingleValueConverter javaClassConverter = new JavaClassConverter(mapper) {};
xstream.registerConverter(javaClassConverter);
xstream.registerConverter(new JavaMethodConverter(javaClassConverter){});
xstream.registerConverter(new JavaFieldConverter(javaClassConverter, mapper){});
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to