commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "petra staub" <>
Subject Digester: dynamic property setter
Date Tue, 20 Jul 2004 08:43:36 GMT


I think this is a trivial question but as I am quite a newbie with
digster, I dare to pose it... ;-)

How can I implement a dynamic property setter?

I have for instance a bean 'address' with different properties and
getter/setters...something like:

public class Address {
  private String firstname;
  private String lastname;

  public void setFirstname(String str) {
    firstname = str;
  public String getFirstname() {
    return firstname;

I want now to parse a XML file where the bean properties are
specified by a 'property tag':

  <property id="firstname">petra</property>
  <property id="lastname">staub</property>

What rule do I have to apply for this?
I want to dynamically call the setter method on the bean what
is specified by the attribute 'id'...

I am able to solve this with the existing rules, if I know what
setter I actually want to call. A workaround would be to add
a 'addProperty(key,value)' method to the bean and implement
so a 'DynaBean'...but maybe this can be done with Digester
without this???

Thanks for any help or suggestions!

Sie wollen die letzten Nachrichten oder Ihr eigenes Horoskop per SMS 

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

View raw message