@Test public void system() { Assume.assumeNotNull(System.getProperty("user.home")); VariableResolver resolver = VariableResolver.system(); assertThat(resolver.replace("${user.home}", true), is(System.getProperty("user.home"))); }
public static VariableResolver system() { Map<String, String> entries = new HashMap<>(); entries.putAll(System.getenv()); for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); if (key instanceof String && value instanceof String) { entries.put((String) key, (String) value); } } return new VariableResolver(entries); }
VariableResolver { public static VariableResolver system() { Map<String, String> entries = new HashMap<>(); entries.putAll(System.getenv()); for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); if (key instanceof String && value instanceof String) { entries.put((String) key, (String) value); } } return new VariableResolver(entries); } }
VariableResolver { public static VariableResolver system() { Map<String, String> entries = new HashMap<>(); entries.putAll(System.getenv()); for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); if (key instanceof String && value instanceof String) { entries.put((String) key, (String) value); } } return new VariableResolver(entries); } VariableResolver(Map<String, String> entries); }
VariableResolver { public static VariableResolver system() { Map<String, String> entries = new HashMap<>(); entries.putAll(System.getenv()); for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); if (key instanceof String && value instanceof String) { entries.put((String) key, (String) value); } } return new VariableResolver(entries); } VariableResolver(Map<String, String> entries); static VariableResolver system(); String replace(String string, boolean strict); @Override String toString(); }
VariableResolver { public static VariableResolver system() { Map<String, String> entries = new HashMap<>(); entries.putAll(System.getenv()); for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); if (key instanceof String && value instanceof String) { entries.put((String) key, (String) value); } } return new VariableResolver(entries); } VariableResolver(Map<String, String> entries); static VariableResolver system(); String replace(String string, boolean strict); @Override String toString();  }