Torque generates the following methods
public XKey getFoo()
public void setFoo(XKey key)
public void setFoo(String key)
The BeanIntrospector should look up the getter to determine the property
type and then use that to find the setter. Note that there can only be
one getter, so it should not be a problem. BeanIntrospector contains a
bug, however, and it looks up a setter first and takes whichever one it
finds first and then looks for a getter that matches.
I have modified the version of intake in fulcrum so that it looks up the
getter first. It suffers from the limitation that there must always be
a getter/setter pair, however. This is not a problem for the torque
generated objects as this is always true, but it is annoying to have to
create a setter in other objects when it is not used. I believe this
fix should be in the 2.x tree as well.
john mcnally
Phillip Rhodes wrote:
>
> I have been having troubles with my generated classes from torque and
> finally figured out what was wrong.
>
> All the facts...using the TDK out the box, but get this, using the taglibs
> from struts. The taglibs "bean" uses an object name and property name to
> look up the object in the specified scope and write out the property
> value. It uses reflection for this. However they did reflection, it won't
> work always for overloaded methods. From my understanding it's a
> limitation of reflection vs. the struts implementation. That's why I am here.
>
> Here is from the java.sun.com reflection FAQ:
> If a class has an overloaded method, does the Method.invoke() method use
> the types of the arguments to select which method will be invoked?
> No. Method.invoke() is always invoked on a specific overloading of the
> method, previously selected by a call to Class.getMethod() or by other
> means. The Reflection API does not automatically choose between overloadings.
>
> Reflection (introspection) will not work well if there is method
> overloading in a class. In torque generated classes, there is
> overloading. Has anyone had problems with this? is there a work
> around? I don't want to customize my torque generated classes!
>
> Example...
>
> public void setScaleId(String v ) throws Exception
> {
> setScaleId(new NumberKey(v));
> }
> public void setScaleId(NumberKey v ) throws Exception
> {
> ....
> }
>
> Thanks... I will be able to contribute to others want I am up to speed
> with turbine.
>
> _________________________________________________________
>
> Do You Yahoo!?
>
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> --
> To unsubscribe, e-mail: <mailto:[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]>