commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin>
Subject [Digester] Problems setting a bean property
Date Thu, 30 Jun 2005 06:47:39 GMT

in a nutshell: after adding a method called "is<property name>" that 
returns a boolean value, Digester does not set the bean's property anymore.

I have the following simple XML file:

    <!DOCTYPE root>

I'm using Digester to set a field in a bean "Value":

    public class Value {

        private String value;

        public String getValue() {
            return this.value;

        public void setValue(String value) {
            this.value = value;

Calling the code

    Digester digester = new Digester();

    digester.addObjectCreate("values/value", Value.class);
    digester.addSetNext("values/value", "add", "java.lang.Object");
    digester.addBeanPropertySetter("values/value", "value");

    List values = new ArrayList();


    Iterator iterator = values.iterator();
    while (iterator.hasNext()) {
        Value aValue = (Value);

prints "one two" to the console.

If I add a method "isValue()" to the class Value

    public boolean isValue() {
        return this.value != null;

"null null" is printed to the console.

So, after adding that method to the bean, Digester (or one of it's used 
components) does not call the method to set the field (setter) anymore.

Is this behavior intended, or is this a bug?


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