chain static method

Combines multiple PersistenceFilters.

The returned filter is eager, which means that it will return false immediately and not check the reaming filters once a filter returned false.

Implementation

static PersistenceFilter chain(Iterable<PersistenceFilter> filters) {
  return filters.fold(takeAll, (previousValue, element) {
    return (Map<String, String> action) {
      if (previousValue(action)) {
        return element(action);
      } else {
        return false;
      }
    };
  });
}