@Test public void testResolveAllValues() { Map<String, String> values = new HashMap<>(); values.put("val1", "value"); values.put("val2", "${val1}2"); values.put("val3", "${val2}--3${val1}"); values.put("val4", "pre- ${val3} -- ${val1} -- ${val2} -post"); values.put("val5", "${doesNotExist}"); Map<String, String> updated = MapfishJsonStyleVersion2.resolveAllValues(values); assertEquals(5, updated.size()); assertEquals("value", updated.get("val1")); assertEquals("value2", updated.get("val2")); assertEquals("value2--3value", updated.get("val3")); assertEquals("pre- value2--3value -- value -- value2 -post", updated.get("val4")); assertEquals("${doesNotExist}", updated.get("val5")); }
@VisibleForTesting static Map<String, String> resolveAllValues(final Map<String, String> values) { Map<String, String> toResolve = new HashMap<>(values); Map<String, String> resolved = new HashMap<>(values.size()); while (!toResolve.isEmpty()) { Iterator<Map.Entry<String, String>> entries = toResolve.entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, String> next = entries.next(); String value = next.getValue(); final String resolve = resolve(values, value); if (resolve == null) { resolved.put(next.getKey(), value); entries.remove(); } else { next.setValue(resolve); } } } return resolved; }
MapfishJsonStyleVersion2 { @VisibleForTesting static Map<String, String> resolveAllValues(final Map<String, String> values) { Map<String, String> toResolve = new HashMap<>(values); Map<String, String> resolved = new HashMap<>(values.size()); while (!toResolve.isEmpty()) { Iterator<Map.Entry<String, String>> entries = toResolve.entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, String> next = entries.next(); String value = next.getValue(); final String resolve = resolve(values, value); if (resolve == null) { resolved.put(next.getKey(), value); entries.remove(); } else { next.setValue(resolve); } } } return resolved; } }
MapfishJsonStyleVersion2 { @VisibleForTesting static Map<String, String> resolveAllValues(final Map<String, String> values) { Map<String, String> toResolve = new HashMap<>(values); Map<String, String> resolved = new HashMap<>(values.size()); while (!toResolve.isEmpty()) { Iterator<Map.Entry<String, String>> entries = toResolve.entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, String> next = entries.next(); String value = next.getValue(); final String resolve = resolve(values, value); if (resolve == null) { resolved.put(next.getKey(), value); entries.remove(); } else { next.setValue(resolve); } } } return resolved; } MapfishJsonStyleVersion2(
            @Nonnull final PJsonObject json,
            @Nonnull final StyleBuilder styleBuilder,
            @Nullable final Configuration configuration,
            @Nonnull final ClientHttpRequestFactory requestFactory); }
MapfishJsonStyleVersion2 { @VisibleForTesting static Map<String, String> resolveAllValues(final Map<String, String> values) { Map<String, String> toResolve = new HashMap<>(values); Map<String, String> resolved = new HashMap<>(values.size()); while (!toResolve.isEmpty()) { Iterator<Map.Entry<String, String>> entries = toResolve.entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, String> next = entries.next(); String value = next.getValue(); final String resolve = resolve(values, value); if (resolve == null) { resolved.put(next.getKey(), value); entries.remove(); } else { next.setValue(resolve); } } } return resolved; } MapfishJsonStyleVersion2(
            @Nonnull final PJsonObject json,
            @Nonnull final StyleBuilder styleBuilder,
            @Nullable final Configuration configuration,
            @Nonnull final ClientHttpRequestFactory requestFactory);  }
MapfishJsonStyleVersion2 { @VisibleForTesting static Map<String, String> resolveAllValues(final Map<String, String> values) { Map<String, String> toResolve = new HashMap<>(values); Map<String, String> resolved = new HashMap<>(values.size()); while (!toResolve.isEmpty()) { Iterator<Map.Entry<String, String>> entries = toResolve.entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, String> next = entries.next(); String value = next.getValue(); final String resolve = resolve(values, value); if (resolve == null) { resolved.put(next.getKey(), value); entries.remove(); } else { next.setValue(resolve); } } } return resolved; } MapfishJsonStyleVersion2(
            @Nonnull final PJsonObject json,
            @Nonnull final StyleBuilder styleBuilder,
            @Nullable final Configuration configuration,
            @Nonnull final ClientHttpRequestFactory requestFactory);   }