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