Add mixin interface for matchable predicates

Only change predicates need to have a match method, because for
historic reasons changes may be loaded from multiple sources.
Predicates for other indices do not need to implement a match method
because the data is always loaded from the index. An exception are
the predicates that check visibility for which a match method is
always required.

Change-Id: I3492bc83b6faf6708ab0102a49463aa0d4a3d10b
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-06-28 10:00:53 +02:00
parent 4492ab39e8
commit cc82b24695
76 changed files with 459 additions and 249 deletions

View File

@@ -18,7 +18,6 @@ import com.google.gerrit.server.query.OperatorPredicate;
import com.google.gerrit.server.query.Predicate;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gerrit.server.query.change.ChangeQueryBuilder;
import com.google.gwtorm.server.OrmException;
import org.junit.Ignore;
@@ -44,16 +43,6 @@ public class FakeQueryBuilder extends ChangeQueryBuilder {
}
private Predicate<ChangeData> predicate(String name, String value) {
return new OperatorPredicate<ChangeData>(name, value) {
@Override
public boolean match(ChangeData object) throws OrmException {
return false;
}
@Override
public int getCost() {
return 0;
}
};
return new OperatorPredicate<ChangeData>(name, value) {};
}
}

View File

@@ -24,16 +24,6 @@ public abstract class PredicateTest extends GerritBaseTests {
protected TestPredicate(String name, String value) {
super(name, value);
}
@Override
public boolean match(String object) {
return false;
}
@Override
public int getCost() {
return 0;
}
}
protected static TestPredicate f(String name, String value) {