View Javadoc

1   /**
2    * 
3    */
4   package test.crispy.example.modify;
5   
6   import net.sf.crispy.InterceptorContext;
7   import net.sf.crispy.Modifier;
8   
9   /**
10   * @author Linke
11   *
12   */
13  public class EchoModifierAfter implements Modifier {
14  
15  	public static final String NEW_ECHO_STRING_AFTER = "new echo string after";
16  	/**
17  	 * @see net.sf.crispy.Modifier#modifyBeforeInvocation(net.sf.crispy.InterceptorContext)
18  	 */
19  	public InterceptorContext modifyBeforeInvocation(InterceptorContext pvInterceptorContext) {
20  		return pvInterceptorContext;
21  	}
22  
23  	/**
24  	 * @see net.sf.crispy.Modifier#modifyAfterInvocation(net.sf.crispy.InterceptorContext)
25  	 */
26  	public InterceptorContext modifyAfterInvocation(InterceptorContext pvInterceptorContext) {
27  		String lvMethodName = pvInterceptorContext.getMethod().getName();
28  		if (lvMethodName.equals("echo")) {
29  			pvInterceptorContext.setResult(NEW_ECHO_STRING_AFTER);
30  		}		
31  		return pvInterceptorContext;
32  	}
33  
34  
35  }