@Test public void testExpand() { assertEquals(System.getProperty("user.home") + "/f", new TildeExpander().expand("~/f")); }
public String expand(final String name) { if(name.startsWith(Local.HOME)) { final String expanded = preferences.getProperty("local.user.home") + StringUtils.substring(name, 1); if(log.isDebugEnabled()) { if(!StringUtils.equals(expanded, name)) { log.debug(String.format("Expanded %s to %s", name, expanded)); } } return expanded; } return name; }
TildeExpander { public String expand(final String name) { if(name.startsWith(Local.HOME)) { final String expanded = preferences.getProperty("local.user.home") + StringUtils.substring(name, 1); if(log.isDebugEnabled()) { if(!StringUtils.equals(expanded, name)) { log.debug(String.format("Expanded %s to %s", name, expanded)); } } return expanded; } return name; } }
TildeExpander { public String expand(final String name) { if(name.startsWith(Local.HOME)) { final String expanded = preferences.getProperty("local.user.home") + StringUtils.substring(name, 1); if(log.isDebugEnabled()) { if(!StringUtils.equals(expanded, name)) { log.debug(String.format("Expanded %s to %s", name, expanded)); } } return expanded; } return name; }  }
TildeExpander { public String expand(final String name) { if(name.startsWith(Local.HOME)) { final String expanded = preferences.getProperty("local.user.home") + StringUtils.substring(name, 1); if(log.isDebugEnabled()) { if(!StringUtils.equals(expanded, name)) { log.debug(String.format("Expanded %s to %s", name, expanded)); } } return expanded; } return name; }  String abbreviate(final String name); String expand(final String name); }
TildeExpander { public String expand(final String name) { if(name.startsWith(Local.HOME)) { final String expanded = preferences.getProperty("local.user.home") + StringUtils.substring(name, 1); if(log.isDebugEnabled()) { if(!StringUtils.equals(expanded, name)) { log.debug(String.format("Expanded %s to %s", name, expanded)); } } return expanded; } return name; }  String abbreviate(final String name); String expand(final String name);  }