1 package ch.ethz.prose.crosscut; 22 import java.lang.IllegalAccessException ; 23 import java.io.Serializable ; 24 import ch.ethz.jvmai.JoinPoint; 25 import java.lang.Object ; 26 import java.lang.reflect.InvocationTargetException ; 27 31 60 abstract class McutAdvice implements Serializable 61 { 62 private final MethodCut methodCut; 63 private static final int UNKNOWN = -1; 64 65 transient protected Object [] stackArgs = null; 66 transient protected int stackArgsLength = UNKNOWN; 67 transient protected MethodCutSignaturePattern advice; 68 69 protected McutAdvice(MethodCut methodCut, JoinPoint joinPoint, MethodCutSignaturePattern advice) 70 { 71 this.advice = advice; 72 Object [] args = joinPoint.getArgs(); 73 allocStackArgs(args.length + 1); 74 75 stackArgs[0] = joinPoint.getThis(); 76 for (int i=0; i<args.length; i++) 77 stackArgs[i+1]=args[i]; 78 this.methodCut = methodCut; 79 80 } 81 82 protected void allocStackArgs(int expectedLength) 84 { 85 stackArgsLength = expectedLength; 86 stackArgs= new Object [stackArgsLength]; 87 } 88 89 abstract protected void execute() throws IllegalAccessException , InvocationTargetException ; 90 } 91 | Popular Tags |