I thought it was your getter's that were causing you trouble.  The get method for
the generated classes is not overloaded, but in your case (as in mine) the get 
method returns an object of a type that is not defined in java.lang.  Again, I 
don't know if this has any bearing on the problem, all I know is that when I 
temporarily changed the generated class to return a String instead of a StringKey
the getter was found.

The workaround that I am currently using is the following:

Method getGetter(String attr)
    throws Exception
{
    StringBuffer getter = new StringBuffer("get");
    getter.append(attr.substring(0, 1).toUpperCase()).
     append(attr.substring(1));
    return(org.apache.velocity.util.introspection.Introspector.getMethod(
     _beanClass, getter.toString(), EMPTY_ARGS));
}

It is kludgy and it should not be necessary, but I didn't have the time or 
motivation to dig into the introspection stuff to figure out the actual problem.

-Brian



Phillip Rhodes <[EMAIL PROTECTED]> 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]>


-- 
Brian Lawler


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

Reply via email to