use of com.navercorp.pinpoint.bootstrap.util.RegexPathMatcher in project pinpoint by naver.
the class SpringBeansTarget method compilePattern.
List<PathMatcher> compilePattern(List<String> patternStrings, final String separator) {
if (CollectionUtils.isEmpty(patternStrings)) {
return null;
}
final List<PathMatcher> pathMatchers = new ArrayList<>(patternStrings.size());
for (String patternString : patternStrings) {
final int prefixEnd = patternString.indexOf(":");
if (prefixEnd != -1) {
final String prefix = patternString.substring(0, prefixEnd).trim();
if (prefix.equals(ANT_STYLE_PATTERN_PREFIX)) {
final String trimmed = patternString.substring(prefixEnd + 1).trim();
if (!trimmed.isEmpty()) {
pathMatchers.add(new AntPathMatcher(trimmed, separator));
}
continue;
} else if (prefix.equals(REGEX_PATTERN_PREFIX)) {
final String trimmed = patternString.substring(prefixEnd + 1).trim();
if (!trimmed.isEmpty()) {
final Pattern pattern = Pattern.compile(trimmed);
pathMatchers.add(new RegexPathMatcher(pattern));
}
continue;
}
}
final Pattern pattern = Pattern.compile(patternString);
pathMatchers.add(new RegexPathMatcher(pattern));
}
return pathMatchers;
}
Aggregations