commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <jcar...@carmanconsulting.com>
Subject Re: [digester] help on fixing DIGESTER-153
Date Mon, 14 Nov 2011 11:51:08 GMT
Sounds easy enough, but it might involve rethinking the guts of digester a
bit.  Let me "digest" on that a bit, but I think we can do it somewhat
easily.

Sent from tablet device.  Please excuse typos and brevity.
On Nov 14, 2011 3:02 AM, "Simone Tripodi" <simonetripodi@apache.org> wrote:

> Hi all guys,
> I'm writing to ask you all a big help on fixing that issues that is
> spoling my sweet dreams and completely blocking for the rest :)
>
> The well known issue is that the Digester has been able to create
> objects using only the default empty constructor, that is because
> instances are created when the XML elements begin.
>
> Thanks to Matt Benson's effort, using CGLIB it is possible to create
> instances using arbitrary constructors, extracting arguments from the
> same matching XML element attributes.
>
> I am sure we can do even more, extracting constructor arguments from
> nested elements, I mean, given the following POJO:
>
> class MyBean
> {
>
>  // (g|s)etter omitted
>  private float floatProperty;
>
>  public MyBean( double doubleProperty, boolean booleanProperty )
>    ...
> }
>
> and the following XML snippet
>
> <toplevel>
>  <bean double="9.99">
>    <boolean>true</boolean>
>    <float>5.5</float>
>  </bean>
> </toplevel>
>
> I would like - but don't know how, that's here that I need help - via
> CGLIB (or something similar) implementing a Lazy Initialization policy
> that allows us creating a proxy that tracks the Object methods
> invocations, but the constructor and methods will be invoked only when
> the matchin XML element terminates.
>
> Just to be more clear:
>
> <toplevel>
>  <bean double="9.99">            <!-- create the MyBean Proxy,
> register the 1st ctor argument -->
>    <boolean>true</boolean>     <!-- register the 2nd ctor argument -->
>    <float>5.5</float>                <!-- track invokation of the
> setBeanProperty -->
>  </bean>                                <!-- matche ends, invoke the
> constructor and tracked methods -->
> </toplevel>
>
> Do you think that would be possible?
> Many thanks in advance, all the best!
> Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message