Issue Type: Improvement Improvement
Affects Versions: 1.3.1
Assignee: Jörg Schaible
Components: Converters
Created: 08/Apr/13 10:00 AM
Description:

JavaClassConverter does not use the class aliasing mapper. It writes and reads non-aliased class names. Example:

public class C1 implements Serializable {
private static final long serialVersionUID = 1L;
}

public class C2 implements Serializable {
static private final long serialVersionUID = 1L;

public HashMap<Class<?>, Integer> f = new HashMap<Class<?>, Integer>();

public C2()

{ f.put(C1.class, Integer.valueOf(1)); }

}

public class Test {
public static void main(String[] args) throws IOException

{ XStream xstream = new XStream(new DomDriver()); xstream.alias("a1", C1.class); xstream.alias("a2", C2.class); File file = new File("test.xml"); serialize(xstream, file); }

public static void serialize(XStream xstream, File file) throws IOException {
C2 c2 = new C2();
OutputStream os = new FileOutputStream(file);

try

{ xstream.toXML(c2, os); }

finally

{ os.close(); }

}
}

writes

<a2>
<f>
<entry>
<java-class>javaClass.C1</java-class>
<int>1</int>
</entry>
</f>
</a2>

and not

<a2>
<f>
<entry>
<java-class>javaClass.a1</java-class>
<int>1</int>
</entry>
</f>
</a2>

Project: XStream
Priority: Minor Minor
Reporter: Till Wenzinger
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