commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Cheshire" <>
Subject [digester] FactoryCreateRule help
Date Wed, 13 Sep 2006 01:01:07 GMT
I have to process an XML file that contains (in part) the following structure

I have a predefined list of variables based upon their ID, an abstract
Variable class, and then concrete subclasses of these for each valid

Variable contains a static method Variable getInstance(int ID) that
creates a new variable subclass based upon the ID (the id-subclass
mapping is based upon a properties file).

The FactoryCreateRule allows for creation of classes based via a
factory providing the identifiying parameter is an XML attribute. In
this case it is not. It is a sub-element, I have no control over that.

How can I use the FactoryCreateRule to call getInstance(int ID) in my
Variable class when I need to extract the ID from a nested element not
an attribute?



PS I did explore other options for the Variable class where there is
just one class, but there is a need for polymorphism with regards to
the variables that have led me to implement it this way, so changing
Variable is also not an option.

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

View raw message