1 package ch.ethz.inf.iks.jvmai.jvmdi; 22 23 import ch.ethz.jvmai.MethodEntryJoinPoint; 24 import ch.ethz.jvmai.MethodExitJoinPoint; 25 import ch.ethz.jvmai.JoinPointKinds; 26 27 31 public class MethodExecutionJoinPointImpl 32 extends CodeJoinPointImpl 33 implements MethodEntryJoinPoint,MethodExitJoinPoint,JoinPointKinds 34 { 35 36 private int mask; 37 protected void setKind(boolean isEntryJP) 38 { 39 isEntryJoinPoint=isEntryJP; 40 if(isEntryJoinPoint) 41 mask = MASK_CODE_JP | MASK_METHOD_ENTRY_JP; 42 else 43 mask = MASK_CODE_JP | MASK_METHOD_EXIT_JP; 44 45 } 46 47 private boolean isEntryJoinPoint; 48 protected MethodExecutionJoinPointImpl(ControlFlow cf, JoinPointContext ctx) 49 { 50 super(cf,ctx); 51 } 52 53 public void setArg(int position, Object value) 54 { 55 context.setLocalValue(value,position); 56 } 57 58 public int getMask() 59 { 60 return mask; 61 } 62 63 public String getKind() 64 { 65 if (isEntryJoinPoint) 66 return MethodEntryJoinPoint.KIND; 67 else 68 return MethodExitJoinPoint.KIND; 69 } 70 71 public Object getResult() 72 { 73 throw new RuntimeException ("MethodExit getResult not implemented"); 74 } 75 76 public void setResult(Object result) 77 { 78 throw new RuntimeException ("MethodExit setResult not implemented"); 79 } 80 81 82 public Object getTarget() 84 { 85 return getThis(); 86 } 87 88 91 public Class getTargetClass() 92 { 93 return getMethod().getDeclaringClass(); 94 } 95 } 96 | Popular Tags |