All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.featurehub.strategies.matchers.MatcherRegistry Maven / Gradle / Ivy

There is a newer version: 3.3
Show newest version
package io.featurehub.strategies.matchers;

import io.featurehub.sse.model.FeatureRolloutStrategyAttribute;

public class MatcherRegistry implements MatcherRepository {
  @Override
  public StrategyMatcher findMatcher(FeatureRolloutStrategyAttribute attr) {
    switch (attr.getType()) {
      case STRING:
        return new StringArrayMatcher();
      case SEMANTIC_VERSION:
        return new SemanticVersionArrayMatcher();
      case NUMBER:
        return new NumberArrayMatcher();
      case DATE:
        return new DateArrayMatcher();
      case DATETIME:
        return new DateTimeArrayMatcher();
      case BOOLEAN: // can't have arrays, that would be silly
        return new BooleanArrayMatcher();
      case IP_ADDRESS:
        return new IpAddressArrayMatcher();
    }

    return new FallthroughMatcher();
  }

  static class FallthroughMatcher implements StrategyMatcher {
    @Override
    public boolean match(String suppliedValue, FeatureRolloutStrategyAttribute attr) {
      return false;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy