1 27 package ch.ethz.prose.filter; 28 import java.util.Collection ; 29 30 32 40 public 41 class Target 42 { 43 44 50 public static PointCutter inCollection(Collection col) 51 { 52 PointCutter t = new ObjectInCollectionFilter(ObjectFilter.TARGET_ARGS_OBJECT,col); 53 t.setToString("This.inCollection()"); 54 return t; 55 } 56 57 60 public static PointCutter equalsTo(Object obj) 61 { 62 PointCutter t =new ObjectEqualsToFilter(ObjectFilter.TARGET_ARGS_OBJECT,obj); 63 t.setToString("Target.equalsTo(" + obj.toString() + ")"); 64 return t; 65 } 66 67 70 public static PointCutter isSameObject(Object obj) 71 { 72 PointCutter t =new ObjectIdenticalToFilter(ObjectFilter.TARGET_ARGS_OBJECT,obj); 73 t.setToString("Target.isSameObject(" + obj + ")"); 74 return t; 75 } 76 77 80 public static PointCutter subtypeOf(Class cls) 81 { 82 PointCutter t =new ObjectTypeFilter(ObjectFilter.TARGET_ARGS_OBJECT,cls,ObjectTypeFilter.SUBCLASS_INHERITANCE); 83 t.setToString("Target.subtypeOf(" + cls.getName() + ")"); 84 return t; 85 } 86 87 90 public static PointCutter supertypeOf(Class cls) 91 { 92 PointCutter t = new ObjectTypeFilter(ObjectFilter.THIS_OBJECT,cls,ObjectTypeFilter.SUPERCLASS_INHERITANCE); 93 t.setToString("Target.superTypeOf(" + cls.getName() + ")"); 94 return t; 95 } 96 97 100 public static PointCutter type(Class cls) 101 { 102 PointCutter t = new ObjectTypeFilter(ObjectFilter.THIS_OBJECT,cls,ObjectTypeFilter.NO_INHERITANCE); 103 t.setToString("Target.type(" + cls.getName() + ")"); 104 return t; 105 } 106 107 111 public static PointCutter type(String classRegexp) 112 { 113 PointCutter t = new ObjectInClassNameFilter(ObjectFilter.TARGET_ARGS_OBJECT,classRegexp); 114 t.setToString("Target.type(" + classRegexp+ ")"); 115 return t; 116 } 117 118 122 public static PointCutter inPackage(String packageRegexp) 123 { 124 PointCutter t = new ObjectInPackageFilter(ObjectFilter.TARGET_ARGS_OBJECT,packageRegexp); 125 t.setToString("Target.inPackage(" + packageRegexp + ")"); 126 return t; 127 } 128 129 130 } 131 | Popular Tags |