commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kenneth Stout" <>
Subject [beanutils] not finding the setter
Date Wed, 02 Jul 2003 15:57:59 GMT
Hi all.

I've been running into a problem that appears to be in how beanutils is
dealing with information returned from java.beans.Introspector.

I've created a bean that is similar to the following:

public class SampleBean {
    private String bound;
    public void setBound(String bound) { this.bound = bound; }
    public String getBound() { return bound; }
    public boolean isBound() { return Utils.toBoolean(bound); }

When I use digester to populate the bean the setBound is never called and
the information is lost. Looking in the log file I find that beanutils says
"Skipping read-only property". If I remove the isBound method everything
works just fine. If I leave the isBound and remove the getBound method
beanutils gets upset as "get" is hardcoded and does not accept the "is" form
of a getter.

It appears that java.beans.Introspector is returning three descriptors and
beanutils can only deal with two descriptors and therefore misses the
setter. This is my impression. I was very frustrated by this time, however
it appears that beanutils is hardcode for position 1 and 2 in the
Introspector array to find the getter and setter.

I've checked version 1.6.1, 1.5, and 1.4 with the same results.

Have I missed something?


View raw message