下面列出了java.util.AbstractMap.SimpleImmutableEntry#getValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Filter the provided Metric and complete fields.
*/
private Metric filter(final Metric metric) {
final Date time = metric.getTime() != null ? metric.getTime() : new Date();
final Map<String, String> tags = selectTags(metric);
final Map<String, String> commonResource = Maps.newHashMap(resource);
commonResource.putAll(metric.getResource());
final SimpleImmutableEntry<Map<String, String>, Map<String, String>>
tagsAndResources = processTagsToResource(tags, commonResource);
final Map<String, String> mergedTags = tagsAndResources.getKey();
final Map<String, String> mergedResource = tagsAndResources.getValue();
final Set<String> mergedRiemannTags = Sets.newHashSet(riemannTags);
mergedRiemannTags.addAll(metric.getRiemannTags());
return new Metric(metric.getKey(), metric.getValue(), time, mergedRiemannTags,
mergedTags, mergedResource, metric.getProc());
}
/**
* Filter the provided Batch and complete fields.
*/
private Batch filter(final Batch batch) {
final Map<String, String> commonTags = Maps.newHashMap(tags);
commonTags.putAll(batch.getCommonTags());
final Map<String, String> commonResource = Maps.newHashMap(resource);
commonResource.putAll(batch.getCommonResource());
final SimpleImmutableEntry<Map<String, String>, Map<String, String>>
tagsAndResources = processTagsToResource(commonTags, commonResource);
final Map<String, String> mergedCommonTags = tagsAndResources.getKey();
final Map<String, String> mergedCommonResource = tagsAndResources.getValue();
final List<Batch.Point> points = batch.getPoints().stream().map(point -> {
final Map<String, String> pointTags = point.getTags();
final Map<String, String> pointResource = point.getResource();
final SimpleImmutableEntry<Map<String, String>, Map<String, String>>
pointTagsAndResources = processTagsToResource(pointTags, pointResource);
final Map<String, String> mergedTags = pointTagsAndResources.getKey();
final Map<String, String> mergedResource = pointTagsAndResources.getValue();
return new Batch.Point(
point.getKey(),
mergedTags,
mergedResource,
point.getValue(),
point.getTimestamp());
}).collect(Collectors.toList());
return new Batch(mergedCommonTags, mergedCommonResource, points);
}