Show QueryTermFilter.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.session.Session;
import net.time4tea.webstats.uri.QueryTerm;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
/**
* Originally richja Apr 17, 2006
*/
public class QueryTermFilter extends BaseMatcher<Session> {
private String queryTermName;
public QueryTermFilter(String queryTermName) {
this.queryTermName = queryTermName;
}
public boolean matches(Session session) {
for (QueryTerm queryTerm : session.entryPage().getURI().getQueryTerms()) {
if (queryTerm.getName().equals(queryTermName)) {
return true;
}
}
return false;
}
public boolean matches(Object item) {
return item instanceof Session && matches((Session) item);
}
public void describeTo(Description description) {
throw new UnsupportedOperationException();
}
}
See more files for this project here