class ConsumerBindingFilter implements Predicate<ConsumerBinding> {

  @Override
  public boolean test(ConsumerBinding d) {
    if (keyQuery != null) {
      if (!matches(d.getKey().getInfrastructureName(), keyQuery.getInfrastructureNameRegex())) {
        return false;
      }
      if (!matches(d.getKey().getInfrastructureZone(), keyQuery.getInfrastructureZoneRegex())) {
        return false;
      }
      if (!matches(d.getKey().getStreamDomain(), keyQuery.getStreamDomainRegex())) {
        return false;
      }
      if (!matches(d.getKey().getStreamName(), keyQuery.getStreamNameRegex())) {
        return false;
      }
      if (keyQuery.getStreamVersion() != null && d.getKey().getStreamVersion() != keyQuery.getStreamVersion()) {
        return false;
      }
      if (!matches(d.getKey().getConsumerName(), keyQuery.getConsumerNameRegex())) {
        return false;
      }
    }
    return matchesSpecification(d.getSpecification(), specQuery);
  }

  public  ConsumerBindingFilter(ConsumerBindingKeyQuery keyQuery, SpecificationQuery specQuery);

}