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 CalculatorModifierAfter implements Modifier {
14
15 public static final Integer NEW_ADD_VALUE = new Integer (-5);
16
17 /**
18 * @see net.sf.crispy.Modifier#modifyBeforeInvocation(net.sf.crispy.InterceptorContext)
19 */
20 public InterceptorContext modifyBeforeInvocation( InterceptorContext pvInterceptorContext) {
21 return pvInterceptorContext;
22 }
23
24 /**
25 * @see net.sf.crispy.Modifier#modifyAfterInvocation(net.sf.crispy.InterceptorContext)
26 */
27 public InterceptorContext modifyAfterInvocation(InterceptorContext pvInterceptorContext) {
28 String lvMethodName = pvInterceptorContext.getMethod().getName();
29 if (lvMethodName.equals("add")) {
30 pvInterceptorContext.setResult(NEW_ADD_VALUE);
31 }
32 return pvInterceptorContext;
33 }
34
35 }