@Test(description = "collect path") public void collectPath() { final String path = PathUtils.collectPath("api", "/users/", "{userId}/"); assertEquals(path, "/api/users/{userId}"); }
public static String collectPath(String... pathParts) { final StringBuilder sb = new StringBuilder(); for (String item : pathParts) { if (StringUtils.isBlank(item)) { continue; } final String path = trimPath(item); if (StringUtils.isNotBlank(path)) { sb.append(SLASH).append(path); } } return sb.length() > 0 ? sb.toString() : String.valueOf(SLASH); }
PathUtils { public static String collectPath(String... pathParts) { final StringBuilder sb = new StringBuilder(); for (String item : pathParts) { if (StringUtils.isBlank(item)) { continue; } final String path = trimPath(item); if (StringUtils.isNotBlank(path)) { sb.append(SLASH).append(path); } } return sb.length() > 0 ? sb.toString() : String.valueOf(SLASH); } }
PathUtils { public static String collectPath(String... pathParts) { final StringBuilder sb = new StringBuilder(); for (String item : pathParts) { if (StringUtils.isBlank(item)) { continue; } final String path = trimPath(item); if (StringUtils.isNotBlank(path)) { sb.append(SLASH).append(path); } } return sb.length() > 0 ? sb.toString() : String.valueOf(SLASH); }  }
PathUtils { public static String collectPath(String... pathParts) { final StringBuilder sb = new StringBuilder(); for (String item : pathParts) { if (StringUtils.isBlank(item)) { continue; } final String path = trimPath(item); if (StringUtils.isNotBlank(path)) { sb.append(SLASH).append(path); } } return sb.length() > 0 ? sb.toString() : String.valueOf(SLASH); }  static String parsePath(String uri, Map<String, String> patterns); static String collectPath(String... pathParts); }
PathUtils { public static String collectPath(String... pathParts) { final StringBuilder sb = new StringBuilder(); for (String item : pathParts) { if (StringUtils.isBlank(item)) { continue; } final String path = trimPath(item); if (StringUtils.isNotBlank(path)) { sb.append(SLASH).append(path); } } return sb.length() > 0 ? sb.toString() : String.valueOf(SLASH); }  static String parsePath(String uri, Map<String, String> patterns); static String collectPath(String... pathParts);  }