pl.allegro.tech.hermes.management.domain.group.GroupNameValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-management Show documentation
Show all versions of hermes-management Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.management.domain.group;
import java.util.regex.Pattern;
import pl.allegro.tech.hermes.management.domain.GroupNameIsNotAllowedException;
class GroupNameValidator {
private final Pattern allowedPattern;
public GroupNameValidator(String allowedRegex) {
this.allowedPattern = Pattern.compile(allowedRegex);
}
public void requireValid(String groupName) {
if (!allowedPattern.matcher(groupName).matches()) {
throw new GroupNameIsNotAllowedException(
String.format("Group name should match pattern %s", allowedPattern));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy