1 27 package ch.ethz.prose.filter; 28 import ch.ethz.jvmai.JoinPoint; 29 import ch.ethz.jvmai.JoinPointKinds; 30 import ch.ethz.prose.engine.JoinPointRequest; 31 import ch.ethz.jvmai.CodeJoinPoint; 32 33 37 abstract class ObjectFilter extends PointCutter implements JoinPointKinds 38 { 39 40 { 41 acceptMask = MASK_ALL_JP; 42 mayFilterStaticallyMask=0; 43 canFilterStaticallyMask=0; 44 } 45 46 public static int TARGET_ARGS_OBJECT = 0x01; 47 public static int THIS_OBJECT = 0x02; 48 protected int objectExtractionMode =0; 49 50 protected ObjectFilter(int targetType) 51 { 52 objectExtractionMode = targetType; 53 } 54 55 56 protected boolean doIsSpecialRequest(JoinPointRequest r) 57 { 58 throw new Error ("the AbstractCrosscuSpecialier should not allow requests in ObjectFilters"); 59 } 60 61 64 protected boolean doIsSpecialEvent(CodeJoinPoint ev) 65 { 66 if (objectExtractionMode == ObjectFilter.TARGET_ARGS_OBJECT) 67 return doIsSpecialObject(ev.getTarget()); 68 69 if (objectExtractionMode == ObjectFilter.THIS_OBJECT) 70 return doIsSpecialObject(ev.getThis()); 71 72 throw new Error ("ObjectFilter.isSpecialEvent: Object filter was initialized with illegal value"); } 73 74 protected abstract boolean doIsSpecialObject(Object target); 75 76 } 77 78 | Popular Tags |