On Wed, 29 Jan 2003, V. Cekvenich wrote:
> Date: Wed, 29 Jan 2003 07:12:47 -0500 > From: V. Cekvenich <[EMAIL PROTECTED]> > Reply-To: Struts Developers List <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Very OT: Java Reflection? > > Someone care to help me out on OT reflection? > > Here is the situation: > My base class has a reflection (in execute) that does this : > > Method eventMethod = this.getClass().getMethod(methodName, args); > > and same class has > onDefaultExec() {} > (or full code here: > >http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/ROOT/src/basicWebLib/org/apache/basicWebLib/dispatch/BaseTilesActionHandler.java > ) > > The concrete (derived) class works great with reflection, it calls the > method in that class. > > However, the problem is that if the concrete class does not have a > reflected method, it won't go look back in the base class for the method > name. In my case onDefaultExec and others are in base, not the instance > class. > > To restate, if I reflect for a method that is concrete class, great, but > when I reflect for a method for a base class I get > reflect.InvocationTargetException > It's not looking back. > Check out the methods :-) in MethodUtils from commons-beanutils -- they know how to search through superclasses (and implemented interfaces) for the correct Method object to call invooke() on. > ? > > tia, > Vic Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]