Skip to content

Commit

Permalink
rename host matcher config
Browse files Browse the repository at this point in the history
  • Loading branch information
danthe1st committed Mar 8, 2024
1 parent 7316782 commit be4dff8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import java.util.Collections;
import java.util.Set;

public record HostMatcherConfig(Set<String> exactHosts,
Set<String> hostParts,
Set<String> hostRegexes) {
public record HostMatcherConfig(Set<String> exact,
Set<String> partial,
Set<String> regex) {

public HostMatcherConfig(Set<String> exactHosts, Set<String> hostParts, Set<String> hostRegexes) {
this.exactHosts = emptyIfNull(exactHosts);
this.hostParts = emptyIfNull(hostParts);
this.hostRegexes = emptyIfNull(hostRegexes);
public HostMatcherConfig(Set<String> exact, Set<String> partial, Set<String> regex) {
this.exact = emptyIfNull(exact);
this.partial = emptyIfNull(partial);
this.regex = emptyIfNull(regex);
}

private Set<String> emptyIfNull(Set<String> data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public IterativeHostMatcher(List<Map.Entry<HostMatcherConfig, T>> configs) {
for(Map.Entry<HostMatcherConfig, T> entry : configs){
HostMatcherConfig config = entry.getKey();
T value = entry.getValue();
if(config.exactHosts().isEmpty() && config.hostParts().isEmpty() && config.hostRegexes().isEmpty()){
if(config.exact().isEmpty() && config.partial().isEmpty() && config.regex().isEmpty()){
wildcardElements.add(value);
}else{
addToMap(hosts, value, config.exactHosts(), Function.identity());
addToMap(parts, value, config.hostParts(), Function.identity());
addToMap(regexes, value, config.hostRegexes(), Pattern::compile);
addToMap(hosts, value, config.exact(), Function.identity());
addToMap(parts, value, config.partial(), Function.identity());
addToMap(regexes, value, config.regex(), Pattern::compile);
}
}
this.exactHosts = toImmutable(hosts);
Expand Down

0 comments on commit be4dff8

Please sign in to comment.