Hi Craig, Glad you shared your opinion. I would tend to agree (even though I was inadvertently breaking the rules). I also believe that BeanUtils makes an assumption as to what is being returned from java.beans.Introspector and as a result it is unable to find the set<PropertyName> descriptor. It then goes so far as to generate a debug message that is misleading.
Would you agree that BeanUtils should find the set<PropertyName>, if it exists, regardless of its position within the descriptors returned by java.beans.Introspector? Kenneth. ----- Original Message ----- From: "Craig R. McClanahan" <[EMAIL PROTECTED]> To: "Jakarta Commons Users List" <[EMAIL PROTECTED]> Sent: Wednesday, July 02, 2003 1:21 PM Subject: Re: [beanutils] not finding the setter > > > On Wed, 2 Jul 2003, Kenneth Stout wrote: > > > Date: Wed, 2 Jul 2003 12:50:14 -0700 > > From: Kenneth Stout <[EMAIL PROTECTED]> > > Reply-To: Jakarta Commons Users List <[EMAIL PROTECTED]> > > To: Jakarta Commons Users List <[EMAIL PROTECTED]> > > Subject: Re: [beanutils] not finding the setter > > > > I hadn't tried making the base property boolean. But my tests show that a > > boolean works with both a get<PropertyName> and is<PropertyName> specified. > > Its a String based property that will not work. Very interesting. > > > > So I guess my question for the community would is, should BeanUtils be > > enhanced to handle the is<PropertyName> descriptor that is returned by > > java.beans.Introspector or should it stay conforming to the "letter of the > > standard"? > > > > The mission of BeanUtils is to provide extended support for JavaBeans. > While there are some things above and beyond plain JavaBeans that are > supported, they are done so in a style that is similar to the way things > work with standard JavaBeans, in order to maximize knowledge transfer and > minimize surprises. > > Doing what it sounds like you are suggesting (allowing a String setter and > a boolean getter for the same property name), though, would violate one of > the core characteristics of JavaBeans -- what a "property" is, and how it > is recognized. Any support for such a thing in BeanUtils would *not* get > reflected into the hundreds of other applications that use standard Java > introspection to acquire property getter and setter information. > Therefore, I think this woud be an exceedingly bad idea, and will -1 a > proposal to implement it. > > You should make sure that your JavaBean is really a JavaBean if you expect > BeanUtils to help you utilize it. One common approach is to use two > different property names in your bean class - something like: > > public boolean isFoo(); > public void setFoo(booean foo); > public String getFooAsString(); > public void setFooAsString(String fooAsString); > > and link the two internally (by doing the appropriate conversions). > > Craig McClanahan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
