abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: The Converter Code
Date Fri, 14 Sep 2007 15:53:04 GMT

Brian Moseley wrote:
> On 9/14/07, James M Snell <jasnell@gmail.com> wrote:
>> 1    Abdera abdera = new Abdera();
>> 2    ConversionContext context =
>> 3       new ConventionConversionContext(abdera);
>> 4    Foo foo = new Foo();
>> 5    Entry entry = context.convert(entry);
> i like how this looks. nice and simple, especially with the naming
> conventions. i assume ConversionContext can also convert an Entry to a
> Foo? can it accept an existing instance of Foo to convert the Entry
> to?

The current code is not bi-directional, but if you provide a Converter
to turn an Entry to a Foo, then yes, it all should just work.  As of
right now, the mechanism only supports creating new instances of the
destination object but it would not take much to modify the impl so that
an existing destination object can be used.

- James

View raw message