Hello xstream committers. I started to create a new dsl to write nodes in xstream converters. The idea is to facilitate the use of converters and writing less.
The project is a available on github: https://github.com/aparra/xstream-writer-dsl Look at some ways to use: converter to Client: public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { build(writer, context).to(source) .node("code", "#id") .node("fullName", "#name") .node("#email") .delegate("home-address", "#address"); } converter to Address: public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { build(writer, context).to(source) .node("#street") .node("#city") .node("#state") .node("#country") .node("zip-code", "#zipCode"); } converter to Order: public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { build(writer, context).to(source) .node("#id") .collection("#products"); } converter to User.Role: public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { build(writer, context).node("role", source); } converter to Invoice: public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { build(writer, context).to(source) .node("#id") .node("total", "#amount", options(":if_not_null")) .node("#dueDate", options(":date_format => dd/MM/yyyy")); } What do you think of this new form of writing nodes? Regards, -- Anderson Parra cel.: (11) 9761-3862
