I ran into the following code recently:
public interface Filter {
Filter NULL_FILTER = new Filter() {
@Override
public Query getFilterCriteria() {
return null;
}
...
@Override
public void setArrayClause(ArrayClause arrayClause) {}
};
/** @return Filter criteria or null if not set */
Query getFilterCriteria();
...
default Filter withProjection(Set<Field> projection) {
this.setFields(projection);
return this;
}
}
It is confusing to me what the purpose of this could be. Can someone explain why someone would write this code?