com.groupbyinc.common.config.featureflags.CustomerFeatureFlag Maven / Gradle / Ivy
package com.groupbyinc.common.config.featureflags;
import org.apache.commons.lang3.StringUtils;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
import java.util.stream.Stream;
public abstract class CustomerFeatureFlag implements FeatureFlag {
public static boolean startsWith(String customerId, String... customerIds) {
return check(checker(customerId, StringUtils::startsWith), customerIds);
}
private static boolean check(Predicate checker, String... customerIds) {
return Stream.of(customerIds).anyMatch(checker);
}
private static Predicate checker(String customerId, BiPredicate predicate) {
return id -> predicate.test(customerId, id);
}
public static boolean matches(String customerId, String... customerIds) {
return check(checker(customerId, StringUtils::equalsIgnoreCase), customerIds);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy