commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <>
Subject [digester] extension annottaion proposal
Date Sat, 03 Oct 2009 20:32:17 GMT
Hi all commons folks!!!
I've been happily using the digester package since the 1.6 release, I
found it very easy to use and absolutely one of the best way to parse
quickly XML documents and mapping them to Java objects :)

Even if using the XML rule declaration, or coding Digester rules, is
absolutely very very easy, times ago I started implementing as a PoC
[1], in my spare time, a facility tool able to create Digester
instances automatically... taking inspiration by Google-Guice and
JPA's annotations, I wonder: "why can't we generate the Digester's
Rules through Java5 annotations?" What I realized in my mind was the
phrase "Basically, the Digester package lets you configure an XML ->
Java object mapping module, which triggers certain actions called
rules whenever a particular pattern of nested XML elements is

So, my idea is: simply given an Annotated Class, we wanted to inspect
it, and extract all the needed to generate the rules - in this way, we
could save time writing the rules manually and reduce the errors while
binding properties and methods'name, arguments etc, etc.

I mean, for example, given the following XML snippet


has to be mapped to the following object

public final class ServletBean {

    private String servletName;

    private String servletClass;

    private final Map<String, String> initParams = new HashMap<String,

    public String getServletName() {
        return this.servletName;

    public void setServletName(String servletName) {
        this.servletName = servletName;

    public String getServletClass() {
        return this.servletClass;

    public void setServletClass(String servletClass) {
        this.servletClass = servletClass;

    public void
String name,
            @CallParam("web-app/servlet/init-param/param-value") String value) {
        this.initParams.put(name, value);



and a special DigesterLoader is able to create Digester rules simply
by analizing the ServletBean class:

Digester digester = DigesterLoader.createDigester(ServletBean.class);

And that's all!

While publishing this work on the Web (already licensed under the
Apache 2.0 License) I wonder whether or not the
Apache Community might be interested on this... would this be of
interested to the community? is there anybody else out there
in the community worked on something similar? I would more than happy to
collaborate and find a way to merge the work into a bigger project eventually.

I aim to achieve a mature version of the project quicker and better; and
ultimately after submitting the proposal to the Commons Commettee as Digester
extension we would like to  find ways grow the work in an official module of the
distribution or a sub-project.

Last, I would personally be really happy to contribute to the ASF in any way and
maintain the above work if necessary.

Thanks in advance, best regards!!!
Simone Tripodi



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message