Hi Joe! Cool you liked! Thanks.

The # prefix is ​​to differentiate beans attributes and node names.
Everyone I showed, asked about # prefix. I'll remove it in the next commit.

This weekend I will begin creating documentation. I received positive
feedback about the dsl, I'm starting to use it in developing, we'll
probably have more evolutions.

I want to contribute more to the xstream project, it's cool!

I warn you about updates.

Regards.

On Tue, Aug 28, 2012 at 10:12 AM, Joe Walnes <[email protected]> wrote:

> Awesome work! Could you provide some more documentation (e.g. what does #
> prefix mean?).
>
> thanks
> -Joe
>
>
> On Mon, Aug 27, 2012 at 7:43 PM, Ander Parra <[email protected]> wrote:
>
>> 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
>>
>
>


-- 
Anderson Parra
cel.: (11) 9761-3862

Reply via email to