Details
-
Type: New Feature
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Annotations, Converters
-
Labels:None
Description
A new way to create a converter using the constructor instead the setters and specifying which nodes of the xml you want to use:
private static class Order {
private final String buyer;
protected Order(String buyer)
{ this.buyer = buyer; }}
Converter orderConverter = ConstructorConverter.forType(Order.class)
.withConstructor(String.class)
.withAliases("buyer")
.build();
xStream.registerConverter(orderConverter);
Order order = (Order) xStream.fromXML(xml);
I am attaching the patch implementing that feature
Hello, any updates in this improvement? It will be accepted?