use of net.morimekta.providence.PMessage in project providence by morimekta.
the class HasFieldValueThat method matches.
@Override
public boolean matches(Object o) {
if (o == null) {
return false;
}
for (int i = 0; i < path.length; ++i) {
if (!(o instanceof PMessage)) {
return false;
}
PMessage actual = (PMessage) o;
PField field = actual.descriptor().findFieldByName(path[i]);
if (field == null) {
return false;
}
if (!actual.has(field.getId())) {
return false;
}
o = actual.get(field.getId());
}
return valueMatcher.matches(o);
}
Aggregations