commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony.Mut...@aeso.ca
Subject RE: [BeanUtils] Mapped properties, this maybe a bug?
Date Mon, 20 Oct 2003 23:29:49 GMT
> -----Original Message-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org] 
> Sent: Monday, October 20, 2003 3:16 PM
> To: Jakarta Commons Users List
> Subject: Re: [BeanUtils] Mapped properties, this maybe a bug?
> 
> 
> Anthony.Mutiso@aeso.ca wrote:
> 
> >Thanks David for the response.
> >
> >I guess then the real questions is why is the silent read-only 
> >assumption the default behavior? Or why not keep looking for setters 
> >even after the first one that comes up does not match the expected 
> >signature?
> >
> >If the non-polymorphic behavior is required rather then convenient, 
> >then of you have other conflicting signatures, maybe a log4j 
> warning to 
> >save other poor souls from hours of debugging?
> >
> >Not that I require this at present, but I could see a 
> situation where a 
> >property has both mapped and scalar behavior especially in an index 
> >world, ala prop(Name) and prop.config.address.
> >
> >  
> >
> 
> The approach for mapped properties was copied from the way that 
> JavaBeans works for scalar and indexed properties.  None of them 
> supports the type of name polymorphism you are describing, 
> and lots of 
> code that talks about "JavaBeans" assumes that you know this 
> kind of the 
> rule already, because it is so universal.
> 
> To know precisely what a JavaBean is, the simplest thing to 
> do is skim 
> the JavaBeans specification.  For the question at hand, 
> you'll want to 
> study the chapter on properties pretty carefully.
> http://java.sun.com/products/javabeans/

Craig, I am sorry, this has created more smoke rather then cleared the air.
On a quick review of the javabeans 1.01 spec an index property does support
getters and setters for the complete array.

void setter(int index, PropertyType value); // indexed setter
PropertyType getter(int index); // indexed getter
void setter(PropertyType values[]); // array setter
PropertyType[] getter(); // array getter

(Chapter 7, Page 41 of the PDF version of the spec).

So if BeanUtil supported mapped javabeans follow a similar patterns is it
not reasonable to expect a Map getter() and maybe even a void setter(Map
map).

(Now I really wonder what happens with Collection classes as indexed
properties, can one say Object getFoo(int index); and List getFoo();).

Maybe it's all that trobbing in my head that is confusing me.
At this point it's now only a matter of seeking enlightenment and a way to
make the headache go away.... :-)

Anthony




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message