@Test public void set_attr() { final Map<MetricName, MetricValue> result = resolve_property(ROOT, new HashSet<String>(Arrays.asList("foo", "bar"))) .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); assertTrue(result.isEmpty()); }
public static Stream<Map.Entry<MetricName, MetricValue>> resolve_property(List<String> attrPath, Object attrObj) { if (attrObj == null) { LOG.log(Level.FINE, "expected a {0} or {1}, but got null", new Object[]{Number.class.getName(), String.class.getName()}); return Stream.empty(); } if (attrObj instanceof Boolean) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromBoolean((Boolean)attrObj))); if (attrObj instanceof Number) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromNumberValue((Number)attrObj))); if (attrObj instanceof String) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromStrValue((String)attrObj))); if (attrObj instanceof Map) return resolve_map_property_(attrPath, (Map)attrObj); if (attrObj instanceof List) return resolve_list_property_(attrPath, (List)attrObj); if (attrObj instanceof Collection) { LOG.log(Level.FINE, "expected a {0} or {1}, but got a Collection: {2}", new Object[]{Number.class.getName(), String.class.getName(), attrObj.getClass().getName()}); return Stream.empty(); } if (attrObj instanceof CompositeData) return resolve_composite_property_(attrPath, (CompositeData)attrObj); LOG.log(Level.FINE, "{1}: measured unparsable value {1}", new Object[]{attrPath, attrObj}); return Stream.empty(); }
AttributeConverter { public static Stream<Map.Entry<MetricName, MetricValue>> resolve_property(List<String> attrPath, Object attrObj) { if (attrObj == null) { LOG.log(Level.FINE, "expected a {0} or {1}, but got null", new Object[]{Number.class.getName(), String.class.getName()}); return Stream.empty(); } if (attrObj instanceof Boolean) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromBoolean((Boolean)attrObj))); if (attrObj instanceof Number) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromNumberValue((Number)attrObj))); if (attrObj instanceof String) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromStrValue((String)attrObj))); if (attrObj instanceof Map) return resolve_map_property_(attrPath, (Map)attrObj); if (attrObj instanceof List) return resolve_list_property_(attrPath, (List)attrObj); if (attrObj instanceof Collection) { LOG.log(Level.FINE, "expected a {0} or {1}, but got a Collection: {2}", new Object[]{Number.class.getName(), String.class.getName(), attrObj.getClass().getName()}); return Stream.empty(); } if (attrObj instanceof CompositeData) return resolve_composite_property_(attrPath, (CompositeData)attrObj); LOG.log(Level.FINE, "{1}: measured unparsable value {1}", new Object[]{attrPath, attrObj}); return Stream.empty(); } }
AttributeConverter { public static Stream<Map.Entry<MetricName, MetricValue>> resolve_property(List<String> attrPath, Object attrObj) { if (attrObj == null) { LOG.log(Level.FINE, "expected a {0} or {1}, but got null", new Object[]{Number.class.getName(), String.class.getName()}); return Stream.empty(); } if (attrObj instanceof Boolean) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromBoolean((Boolean)attrObj))); if (attrObj instanceof Number) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromNumberValue((Number)attrObj))); if (attrObj instanceof String) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromStrValue((String)attrObj))); if (attrObj instanceof Map) return resolve_map_property_(attrPath, (Map)attrObj); if (attrObj instanceof List) return resolve_list_property_(attrPath, (List)attrObj); if (attrObj instanceof Collection) { LOG.log(Level.FINE, "expected a {0} or {1}, but got a Collection: {2}", new Object[]{Number.class.getName(), String.class.getName(), attrObj.getClass().getName()}); return Stream.empty(); } if (attrObj instanceof CompositeData) return resolve_composite_property_(attrPath, (CompositeData)attrObj); LOG.log(Level.FINE, "{1}: measured unparsable value {1}", new Object[]{attrPath, attrObj}); return Stream.empty(); }  }
AttributeConverter { public static Stream<Map.Entry<MetricName, MetricValue>> resolve_property(List<String> attrPath, Object attrObj) { if (attrObj == null) { LOG.log(Level.FINE, "expected a {0} or {1}, but got null", new Object[]{Number.class.getName(), String.class.getName()}); return Stream.empty(); } if (attrObj instanceof Boolean) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromBoolean((Boolean)attrObj))); if (attrObj instanceof Number) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromNumberValue((Number)attrObj))); if (attrObj instanceof String) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromStrValue((String)attrObj))); if (attrObj instanceof Map) return resolve_map_property_(attrPath, (Map)attrObj); if (attrObj instanceof List) return resolve_list_property_(attrPath, (List)attrObj); if (attrObj instanceof Collection) { LOG.log(Level.FINE, "expected a {0} or {1}, but got a Collection: {2}", new Object[]{Number.class.getName(), String.class.getName(), attrObj.getClass().getName()}); return Stream.empty(); } if (attrObj instanceof CompositeData) return resolve_composite_property_(attrPath, (CompositeData)attrObj); LOG.log(Level.FINE, "{1}: measured unparsable value {1}", new Object[]{attrPath, attrObj}); return Stream.empty(); }  static Stream<Map.Entry<MetricName, MetricValue>> resolve_property(List<String> attrPath, Object attrObj); }
AttributeConverter { public static Stream<Map.Entry<MetricName, MetricValue>> resolve_property(List<String> attrPath, Object attrObj) { if (attrObj == null) { LOG.log(Level.FINE, "expected a {0} or {1}, but got null", new Object[]{Number.class.getName(), String.class.getName()}); return Stream.empty(); } if (attrObj instanceof Boolean) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromBoolean((Boolean)attrObj))); if (attrObj instanceof Number) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromNumberValue((Number)attrObj))); if (attrObj instanceof String) return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromStrValue((String)attrObj))); if (attrObj instanceof Map) return resolve_map_property_(attrPath, (Map)attrObj); if (attrObj instanceof List) return resolve_list_property_(attrPath, (List)attrObj); if (attrObj instanceof Collection) { LOG.log(Level.FINE, "expected a {0} or {1}, but got a Collection: {2}", new Object[]{Number.class.getName(), String.class.getName(), attrObj.getClass().getName()}); return Stream.empty(); } if (attrObj instanceof CompositeData) return resolve_composite_property_(attrPath, (CompositeData)attrObj); LOG.log(Level.FINE, "{1}: measured unparsable value {1}", new Object[]{attrPath, attrObj}); return Stream.empty(); }  static Stream<Map.Entry<MetricName, MetricValue>> resolve_property(List<String> attrPath, Object attrObj);  }