commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject [digester] help on fixing DIGESTER-153
Date Mon, 14 Nov 2011 08:02:07 GMT
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
View raw message