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