public TypeMatcher(String descriptor, String role, String typeParameters) { this.descriptor = new NameMatch(descriptor); this.role = role; this.typeParameters = typeParameters; }
public ClassMatcher(String className, String role) { this.className = new NameMatch(className); this.role = role; }
public LocalMatcher(String name, String type) { this.name = new NameMatch(name); }
public LocalMatcher(String name) { this.name = new NameMatch(name); }
public SourceMatcher(String fileName) { this.fileName = new NameMatch(fileName); }
public MemberMatcher(String name, String signature, String role) { if (name == null) { if (signature == null) { throw new FilterException(this.getClass().getName() + " must have either name or signature attributes"); } else { name = "~.*"; // any name } } this.name = new NameMatch(name); this.signature = new NameMatch(signature); this.role = role; }
@Test public void testExactMatch() { NameMatch match = new NameMatch(SignatureUtil.createMethodSignature("", "void")); assertTrue(match.match("()V")); assertFalse(match.match("(I)V")); assertFalse(match.match("()J")); }
@Test public void testReturnValuePatternMatch() { NameMatch anyParamReturnVoid = new NameMatch(SignatureUtil.createMethodSignature("", null)); assertTrue(anyParamReturnVoid.match("()V")); assertTrue(anyParamReturnVoid.match("()I")); assertTrue(anyParamReturnVoid.match("()Ljava/lang/String;")); assertFalse(anyParamReturnVoid.match("(B)J")); } }
@Test public void testParameterPatternMatch() { NameMatch anyParamReturnVoid = new NameMatch(SignatureUtil.createMethodSignature(null, "void")); assertTrue(anyParamReturnVoid.match("()V")); assertTrue(anyParamReturnVoid.match("(I)V")); assertTrue(anyParamReturnVoid.match("(Ljava/lang/String;)V")); assertFalse(anyParamReturnVoid.match("()J")); }
public LocalMatcher(String name, String type) { this.name = new NameMatch(name); }
public TypeMatcher(String descriptor, String role, String typeParameters) { this.descriptor = new NameMatch(descriptor); this.role = role; this.typeParameters = typeParameters; }
public ClassMatcher(String className, String role) { this.className = new NameMatch(className); this.role = role; }
public SourceMatcher(String fileName) { this.fileName = new NameMatch(fileName); }
public LocalMatcher(String name) { this.name = new NameMatch(name); }
public MemberMatcher(String name, String signature, String role) { if (name == null) { if (signature == null) { throw new FilterException(this.getClass().getName() + " must have eiter name or signature attributes"); } else { name = "~.*"; // any name } } this.name = new NameMatch(name); this.signature = new NameMatch(signature); this.role = role; }