Details
- 
        Type: Bug Bug
- 
        Status: Closed Closed
- 
            Resolution: Won't Fix
- 
            Affects Version/s: None
- 
            Fix Version/s: None
- 
            Component/s: None
- 
            Labels:None
Description
I have a class with default values set for fields (ints, Strings). I'm hoping that XStream would set only those fields which are defined in the XML.
When I load the XML, at least ints are set to 0 instead of their default value (-1). I haven't tested other primitives. Here's a small example of what happens now:
Class A:
// omitting getters/setters
class A {
 private int threshold=-1;
 String pattern=null;
}
XML
<a />
Loading with fromXML:
A a = (a)xstream.fromXML(xml);
Result:
a.threshold = 0 // should be -1
a.pattern = null // null is ok
I'm using XStream 1.2 with the DomDriver



This is the expected behaviour. XStream does not run initializers. Please ask question on the user's list.