@Test public void groupNameWithPrefix() { SimpleGroupPath expectedPath = SimpleGroupPath.valueOf("pre", "fix", "true", "false", "18", "foobarium"); Map<String, MetricValue> expectedTags = new HashMap<>(); expectedTags.put("five", MetricValue.TRUE); expectedTags.put("six", MetricValue.FALSE); expectedTags.put("eight", MetricValue.fromIntValue(18)); expectedTags.put("nine", MetricValue.fromStrValue("foobarium")); assertEquals(GroupName.valueOf(expectedPath, expectedTags), map.getGroupName(Arrays.asList("pre", "fix"))); }
public GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags) { final Stream<String> suffixPath = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) .map(Map.Entry::getValue) .map(value -> value.mapCombine(b -> b.toString(), i -> i.toString(), Function.identity())); final SimpleGroupPath path = SimpleGroupPath.valueOf(Stream.concat(prefixPath.stream(), suffixPath).collect(Collectors.toList())); final Map<String, MetricValue> tags = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) .collect(Collectors.toMap(entry -> entry.getKey().getRight().get(), entry -> entry.getValue().mapCombine(MetricValue::fromBoolean, MetricValue::fromIntValue, MetricValue::fromStrValue))); tags.putAll(extraTags); return GroupName.valueOf(path, tags); }
NamedResolverMap { public GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags) { final Stream<String> suffixPath = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) .map(Map.Entry::getValue) .map(value -> value.mapCombine(b -> b.toString(), i -> i.toString(), Function.identity())); final SimpleGroupPath path = SimpleGroupPath.valueOf(Stream.concat(prefixPath.stream(), suffixPath).collect(Collectors.toList())); final Map<String, MetricValue> tags = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) .collect(Collectors.toMap(entry -> entry.getKey().getRight().get(), entry -> entry.getValue().mapCombine(MetricValue::fromBoolean, MetricValue::fromIntValue, MetricValue::fromStrValue))); tags.putAll(extraTags); return GroupName.valueOf(path, tags); } }
NamedResolverMap { public GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags) { final Stream<String> suffixPath = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) .map(Map.Entry::getValue) .map(value -> value.mapCombine(b -> b.toString(), i -> i.toString(), Function.identity())); final SimpleGroupPath path = SimpleGroupPath.valueOf(Stream.concat(prefixPath.stream(), suffixPath).collect(Collectors.toList())); final Map<String, MetricValue> tags = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) .collect(Collectors.toMap(entry -> entry.getKey().getRight().get(), entry -> entry.getValue().mapCombine(MetricValue::fromBoolean, MetricValue::fromIntValue, MetricValue::fromStrValue))); tags.putAll(extraTags); return GroupName.valueOf(path, tags); }  }
NamedResolverMap { public GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags) { final Stream<String> suffixPath = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) .map(Map.Entry::getValue) .map(value -> value.mapCombine(b -> b.toString(), i -> i.toString(), Function.identity())); final SimpleGroupPath path = SimpleGroupPath.valueOf(Stream.concat(prefixPath.stream(), suffixPath).collect(Collectors.toList())); final Map<String, MetricValue> tags = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) .collect(Collectors.toMap(entry -> entry.getKey().getRight().get(), entry -> entry.getValue().mapCombine(MetricValue::fromBoolean, MetricValue::fromIntValue, MetricValue::fromStrValue))); tags.putAll(extraTags); return GroupName.valueOf(path, tags); }  boolean getBooleanOrDefault(int key, boolean dfl); boolean getBooleanOrDefault(@NonNull String key, boolean dfl); int getIntegerOrDefault(int key, int dfl); int getIntegerOrDefault(@NonNull String key, int dfl); String getStringOrDefault(int key, @NonNull String dfl); String getStringOrDefault(@NonNull String key, @NonNull String dfl); boolean getBoolean(int key); boolean getBoolean(@NonNull String key); int getInteger(int key); int getInteger(@NonNull String key); String getString(int key); String getString(@NonNull String key); Set<Integer> intKeySet(); Set<String> stringKeySet(); GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags); GroupName getGroupName(@NonNull SimpleGroupPath prefixPath, @NonNull Map<String, MetricValue> extraTags); GroupName getGroupName(@NonNull List<String> prefixPath); GroupName getGroupName(@NonNull SimpleGroupPath prefixPath); GroupName getGroupName(@NonNull Map<String, MetricValue> extraTags); GroupName getGroupName(); Map<Any2<Integer, String>, Any3<Boolean, Integer, String>> getRawMap(); Map<Any2<Integer, String>, String> getStringMap(); @Override String toString(); }
NamedResolverMap { public GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags) { final Stream<String> suffixPath = data.entrySet().stream() .filter(entry -> entry.getKey().getLeft().isPresent()) .sorted(Comparator.comparing(entry -> entry.getKey().getLeft().get())) .map(Map.Entry::getValue) .map(value -> value.mapCombine(b -> b.toString(), i -> i.toString(), Function.identity())); final SimpleGroupPath path = SimpleGroupPath.valueOf(Stream.concat(prefixPath.stream(), suffixPath).collect(Collectors.toList())); final Map<String, MetricValue> tags = data.entrySet().stream() .filter(entry -> entry.getKey().getRight().isPresent()) .collect(Collectors.toMap(entry -> entry.getKey().getRight().get(), entry -> entry.getValue().mapCombine(MetricValue::fromBoolean, MetricValue::fromIntValue, MetricValue::fromStrValue))); tags.putAll(extraTags); return GroupName.valueOf(path, tags); }  boolean getBooleanOrDefault(int key, boolean dfl); boolean getBooleanOrDefault(@NonNull String key, boolean dfl); int getIntegerOrDefault(int key, int dfl); int getIntegerOrDefault(@NonNull String key, int dfl); String getStringOrDefault(int key, @NonNull String dfl); String getStringOrDefault(@NonNull String key, @NonNull String dfl); boolean getBoolean(int key); boolean getBoolean(@NonNull String key); int getInteger(int key); int getInteger(@NonNull String key); String getString(int key); String getString(@NonNull String key); Set<Integer> intKeySet(); Set<String> stringKeySet(); GroupName getGroupName(@NonNull List<String> prefixPath, @NonNull Map<String, MetricValue> extraTags); GroupName getGroupName(@NonNull SimpleGroupPath prefixPath, @NonNull Map<String, MetricValue> extraTags); GroupName getGroupName(@NonNull List<String> prefixPath); GroupName getGroupName(@NonNull SimpleGroupPath prefixPath); GroupName getGroupName(@NonNull Map<String, MetricValue> extraTags); GroupName getGroupName(); Map<Any2<Integer, String>, Any3<Boolean, Integer, String>> getRawMap(); Map<Any2<Integer, String>, String> getStringMap(); @Override String toString(); static NamedResolverMap EMPTY; }