[jboss-user] [JBoss AOP] - Re: Invoke a method of the class of the intercepted method

stale.pedersen@jboss.org do-not-reply at jboss.com
Mon Dec 10 04:46:28 EST 2007


hi, if you do:
Class classe = ((MethodInvocation)metodo).getClass(); you only get the Class MethodInvocation.
The method you are looking for is getTargetObject(). Then you can do:public Object invoke(Invocation invocation) throws Throwable
  | {
  |   try
  |   {
  |     Object o = invocation.getTargetObject();
  |     System.out.println("TargetObject: "+o.getClass().getName());
  |     POJO pojo = (POJO) o;
  |     //do stuff with pojo;
  |   }
  | }
i hope this helps.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111544#4111544

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111544



More information about the jboss-user mailing list