Re: Very OT: Java Reflection?

2003-01-30 Thread Craig R. McClanahan


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]




Re: Very OT: Java Reflection?

2003-01-30 Thread Vic Cekvenich
Thanks.
I acctulay got it to work, there was somehting else wrong in base, but the
execption name confused me. Sorry for a quick post, but after posting it
clears me to solve it.
:(
"Max Cooper" <[EMAIL PROTECTED]> wrote in message
014501c2c7fe$96eb2a50$8a1e16ac@ozzy">news:014501c2c7fe$96eb2a50$8a1e16ac@ozzy...
> There doesn't seem to be direct help. Perhaps you could do this, or find a
> utility method somewhere that does it for you:
>
> Method method = null;
> Class cls = this.getClass();
> while (method == null && cls != null) {
>method = cls.getMethod(methodName, args);
>cls = cls.getSuperClass();
> }
>
> Please post the answer if you find a good one.
>
> -Max
>
> - Original Message -
> From: "V. Cekvenich" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 29, 2003 4:12 AM
> 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/basicWeb
> Lib/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.
> >
> > ?
> >
> > tia,
> > Vic
> >
> >
> >
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >




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




Re: Very OT: Java Reflection?

2003-01-30 Thread Vic Cekvenich
Acrualy, it worked fine

I had another bug in base method, confused me.
.V

Max Cooper wrote:

There doesn't seem to be direct help. Perhaps you could do this, or find a
utility method somewhere that does it for you:

Method method = null;
Class cls = this.getClass();
while (method == null && cls != null) {
   method = cls.getMethod(methodName, args);
   cls = cls.getSuperClass();
}

Please post the answer if you find a good one.

-Max

- Original Message -
From: "V. Cekvenich" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 4:12 AM
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/basicWeb
Lib/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.

?

tia,
Vic






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








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




Re: Very OT: Java Reflection?

2003-01-29 Thread Max Cooper
There doesn't seem to be direct help. Perhaps you could do this, or find a
utility method somewhere that does it for you:

Method method = null;
Class cls = this.getClass();
while (method == null && cls != null) {
   method = cls.getMethod(methodName, args);
   cls = cls.getSuperClass();
}

Please post the answer if you find a good one.

-Max

- Original Message -
From: "V. Cekvenich" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 4:12 AM
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/basicWeb
Lib/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.
>
> ?
>
> tia,
> Vic
>
>
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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




Re: Very OT: Java Reflection?

2003-01-29 Thread V. Cekvenich
Never mind, the base method had error, works as per Java.

V. Cekvenich wrote:

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.

?

tia,
Vic



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




Very OT: Java Reflection?

2003-01-29 Thread V. Cekvenich
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.

?

tia,
Vic






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