[jboss-user] [JBoss AOP] - change text with interceptors

sviluppatorefico do-not-reply at jboss.com
Mon Sep 4 12:15:05 EDT 2006


hi....how I can automatically modify a parameter of 'set' methods? I thought to use a configuration of this type:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <aop>
  |     <interceptor class="segn.util.interceptor.TextFormatInterceptor" scope="PER_CLASS"/>
  |     <bind pointcut="call(public void $instanceof{segn.util.model*}-&gt;set*(java.lang.String))">
  |         <interceptor-ref name="segn.util.interceptor.TextFormatInterceptor"/>
  |     </bind>
  | </aop>

and an interceptor of this type:

public class TextFormatInterceptor implements Interceptor {
  | 	   public String getName() { return "TextFormatInterceptor"; }
  | 	   
  | 	   public Object invoke(Invocation invocation) 
  | 	       throws Throwable
  | 	   {  
  | 	      Object rsp = invocation.invokeNext();
  | 	      return rsp;
  | 	   }
  | }

I have two question:

1- is it right to use an interceptor to format text of 'set' methods of a POJO?
2 - if yes, how I can to do it, seeing that the new org.jboss.aop.joinpoint.Invocation class don't permit the access of info of MethodInvocation?

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

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



More information about the jboss-user mailing list