I am trying out the Simple XML serializer. I am more interested in deserialization from XML->Java. Here is my code as a unit test:
import java.io.StringReade
I don't think you need all that repetition and the extra annotations' attribute. If the name is the same as the object attribute, it will be used by default.
so you can just declare it as:
@Root
class Address {
@Attribute
private final String street;
@Attribute
private final String city;
@Attribute
private final String state;
public Address(String street, String city, String state) {
super();
this.street = street;
this.city = city;
this.state = state;
}
@Override
public String toString() {
return "Address [city=" + city + ", state=" + state + ", street=" + street + "]";
}
}