Show MethodFilter.java syntax highlighted
/*
* This file is distributed under the GPL v2 as part of teastats site statistics package
* http://teastats.sourceforge.net
*/
package net.time4tea.webstats.filter.http;
import net.time4tea.webstats.record.Page;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
/**
* Originally richja Apr 2, 2006
*/
public class MethodFilter extends BaseMatcher<Page> {
private String method;
public MethodFilter(String method) {
this.method = method;
}
private boolean matches(Page page) {
return page.getMethod().equals(method);
}
public boolean matches(Object item) {
return item instanceof Page && matches((Page) item);
}
public void describeTo(Description description) {
throw new UnsupportedOperationException();
}
public static Matcher<Page> methodIs(String method) {
return new MethodFilter(method);
}
}
See more files for this project here