@Override public String configString() { return ConfigSupport.quotedString(value_).toString(); } @Override
@Override public StringBuilder configString() { return ConfigSupport.maybeQuoteIdentifier(identifier_); }
@Override public StringBuilder configString() { return collectorConfigString(name, builder) .append('\n'); } }
@Override public String toString() { Stream<String> intSet = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) .map(entry -> entry.getKey().getLeft().get() + "=" + entry.getValue().mapCombine(b -> b.toString(), i -> i.toString(), s -> ConfigSupport.quotedString(s))); Stream<String> strSet = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getRight().get())) .map(entry -> ConfigSupport.maybeQuoteIdentifier(entry.getKey().getRight().get()) + "=" + entry.getValue().mapCombine(b -> b.toString(), i -> i.toString(), s -> ConfigSupport.quotedString(s))); return Stream.concat(intSet, strSet) .collect(Collectors.joining(", ", "NamedResolverMap{", "}")); } }
.append(getPredicate().configString()) .append(" for ") .append(durationConfigString(fire_duration_)) .append(" message ") .append(quotedString(getMessage())); if (attributes_.isEmpty()) { return result.append(";\n"); result .append(" ") .append(maybeQuoteIdentifier(attr.getKey())) .append(" = ") .append(attr.getValue().<CharSequence>mapCombine(
/** * Create a quoted string configuration element. * @param s a string. * @return the string, between quotes, escaped such that the configuration parser will accept it as a string. */ public static StringBuilder quotedString(String s) { final EscapeStringResult escapeString = escapeString(s, '\"'); final StringBuilder result = escapeString.buffer; result.insert(0, '\"'); result.append('\"'); return result; }
@Override public String configString() { return underlying.configString() + "[" + durationConfigString(minAge) + " - " + durationConfigString(maxAge) + " ]"; }
@Override public StringBuilder populateExpression(StringBuilder buf) { buf.append(ConfigSupport.regex(regex)); return successor .map((succ) -> succ.populateExpression(buf.append('.'))) .orElse(buf); }
@Override public String toString() { Stream<String> intSet = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) .map(entry -> entry.getKey().getLeft().get() + "=" + entry.getValue().mapCombine(b -> b.toString(), i -> i.toString(), s -> ConfigSupport.quotedString(s))); Stream<String> strSet = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getRight().get())) .map(entry -> ConfigSupport.maybeQuoteIdentifier(entry.getKey().getRight().get()) + "=" + entry.getValue().mapCombine(b -> b.toString(), i -> i.toString(), s -> ConfigSupport.quotedString(s))); return Stream.concat(intSet, strSet) .collect(Collectors.joining(", ", "NamedResolverMap{", "}")); } }
/** * Create a regex configuration element. * @param s a regex * @return the regex as a configuration regex, which is escaped where needed. */ public static StringBuilder regex(String s) { return escapeString(s, '/').buffer .insert(0, "//") .append("//"); }
@Override public String configString() { return ConfigSupport.quotedString(value_).toString(); } @Override
@Override public StringBuilder configString() { return ConfigSupport.maybeQuoteIdentifier(identifier_); }
/** * Create a quoted string configuration element. * @param s a string. * @return the string, between quotes, escaped such that the configuration parser will accept it as a string. */ public static StringBuilder quotedString(String s) { final EscapeStringResult escapeString = escapeString(s, '\"'); final StringBuilder result = escapeString.buffer; result.insert(0, '\"'); result.append('\"'); return result; }
@Override public StringBuilder configString() { return new StringBuilder() .append("import ") .append(getSelectorKeywords()) .append(" from ") .append(ConfigSupport.quotedString(fname_)) .append(";\n"); }
@Override public StringBuilder configString() { StringBuilder result = new StringBuilder("without ("); tags.stream().sorted().forEachOrdered(tag -> result.append(maybeQuoteIdentifier(tag)).append(", ")); result.replace(result.length() - 2, result.length(), ")"); return result; } }
/** * Create a regex configuration element. * @param s a regex * @return the regex as a configuration regex, which is escaped where needed. */ public static StringBuilder regex(String s) { return escapeString(s, '/').buffer .insert(0, "//") .append("//"); }
@Override public StringBuilder configString() { return quotedString(getValue()); } }
private static StringBuilder tag_as_string_(String key, MetricValue value) { return maybeQuoteIdentifier(key) .append('=') .append(value.configString()); }
/** * Create an identifier configuration element. * @param s an identifier * @return the identifier as a string, which is escaped and quoted if needed. */ public static StringBuilder maybeQuoteIdentifier(String s) { final EscapeStringResult escapeString = escapeString(s, '\''); final StringBuilder result = escapeString.buffer; final boolean need_quotes = s.isEmpty() || escapeString.needQuotes || KEYWORDS.contains(s) || !IDENTIFIER_MATCHER.test(s); if (need_quotes) { result.insert(0, '\''); result.append('\''); } return result; }
@Override public String toString() { return exprs.entrySet().stream() .sorted(Comparator.comparing(Map.Entry::getKey)) .map(entry -> quotedString(entry.getKey()).toString() + '=' + entry.getValue().configString().toString()) .collect(Collectors.joining(", ", "{", "}")); } }