I think the issue is that a particular property has to have a specific
type.  When you start overloading methods, it becomes ambiguous.  It's
not even legal Java to overload on return type alone, so I'm not sure
what Edgar meant about overloading the getter.

It's perfectly fine, though, to have "linked" properties, i.e., two sets
of getters and setters (with different names) that internally set the
same field.  I often have sets of methods like getFoo/setFoo and
getFooAsString/setFooAsString.  The latter methods just call the normal
getter/setter with some kind of conversion.

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863


> -----Original Message-----
> From: Carl Fyffe [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 24, 2002 1:13 PM
> To: 'Struts Developers List'
> Subject: RE: Overloaded Setters in Form
> 
> 
> Edgar does have a point, the spec doesn't say beans *bad 
> joke* about overloading.  I gave it another go after reading 
> (AGAIN) Craig's first post on this topic (12/14/2002) and 
> this time, instead of using a null getter, I provided a 
> getter for the overloaded setter.  Still does not work.  
> Introspector only returns one PropertyDescriptor for the 
> property.  Edgar and Craig both lead me to believe that this 
> is possible, but I am starting to think that I am trying to 
> put a square peg in a round hole.
> 
> Edgar: Would you be willing to share some of your 
> implementation details?
> 
> Architectural Gurus: The problem I am trying to solve is that 
> I have a data source that returns Strings only (xml file), 
> should I create Beans specifically for that data source and 
> then convert over to my Form?
> 
> Thanks for all of your help,
> 
> Carl
> 
> 
> 
> -----Original Message-----
> From: Edgar P. Dollin [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 24, 2002 10:26 AM
> To: 'Struts Developers List'
> Subject: RE: Overloaded Setters in Form
> 
> 
> I have had success overloading properties and used the effect 
> liberally. I have found that if you are consistent in your 
> overloading, i.e. for every setter of type x supply a getter 
> of type x as well (at least in the containers I am using) 
> they seem to function.  
> 
> Based on your comments, I have a concern that something will 
> break going forward.  I looked for overloading in the spec 
> (attached) and they don't specifically speak to the issue.
> 
>       http://java.sun.com/products/javabeans/docs/beans.101.pdf
> 
> Could you point me toward some documentation which gives more details?
> 
> Thanks
> 
> Edgar
> 
> -----Original Message-----
> From: Ted Husted [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 24, 2002 9:12 AM
> To: Struts Developers List
> Subject: Re: Overloaded Setters in Form
> 
> 
> It's contrary to the JavaBean specification to overload the 
> property methods (getters and setters), if that's what you are 
> trying to do. So, it won't work, because it's not suppose to.
> 
> -Ted.
> 
> 
> 12/23/2002 10:31:41 PM, Carl Fyffe <[EMAIL PROTECTED]> wrote:
> >Seasons greetings friends!
> >
> >I sent an email inquiring about overloaded setters in Forms to the 
> >struts-user mailing list.  I was told that I needed a 
> BeanInfo.  I gave
> >the BeanInfo a try and it did not work.  So, I started reading
> >code and
> >decided that an overloaded example in TestBean was needed.  Of 
> course it
> >now fails just like my example.  I am stuck there.  The 
> BeanInfo's that
> 
> >I have created, with and without my overloaded methods, do 
> not  work. 
> >Does anyone have a TestBeanBeanInfo that works?  Any advice would  be
> >greatly appreciated.
> >
> >Carl
> >
> >
> >--
> >To unsubscribe, e-mail:   <mailto:struts-dev-
> [EMAIL PROTECTED]>
> >For additional commands, e-mail: <mailto:struts-dev-
> [EMAIL PROTECTED]>
> >
> >
> 
> 
> 
> 
> --
> To unsubscribe, e-mail: 
> <mailto:struts-dev-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail: 
> <mailto:struts-dev-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-dev-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to