commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kenneth Stout" <kenneth.st...@comcast.net>
Subject Re: [beanutils] not finding the setter
Date Wed, 02 Jul 2003 18:03:51 GMT
Thanks Wendy and Jose for responding.

Point taken. My bean is not in fact a valid bean.

This does beg the question then, why does java.beans.Introspector return a
non-conforming getter? Based on the documentation provided it should not
have returned isBound as the valid getter much less returning both isBound
and getBound which in turned confused beanutils into thinking there was no
setter.

Thanks again,
Kenneth.

----- Original Message ----- 
From: "Wendy Smoak" <Wendy.Smoak@asu.edu>
To: "'Jakarta Commons Users List'" <commons-user@jakarta.apache.org>
Sent: Wednesday, July 02, 2003 9:39 AM
Subject: RE: [beanutils] not finding the setter


> Kenneth wrote:
> > 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); } }
> > Have I missed something?
>
> Yes, your class does not comply with the JavaBeans specification.  You
can't
> have both 'is' and 'get' methods, pick one or the other to go with your
> 'set' method (and the types will have to match).
>
> http://java.sun.com/products/javabeans/docs/spec.html
> See section 8.3 Design Patterns for Properties
>
> -- 
> Wendy Smoak
> Applications Systems Analyst, Sr.
> Arizona State University, PA, IRM
>


Mime
View raw message