@Test public void testPackageToNamespace() { assertNull(NamespaceUtils.toNamespace(null)); assertNull(NamespaceUtils.toNamespace("")); assertEquals("http: assertEquals("http: assertEquals("http: }
public static String toNamespace(String packageName) { if (packageName == null || packageName.length() == 0) { return null; } List < String > tokens = reverse(tokenize(packageName, ".")); StringBuilder buf = new StringBuilder("http: for (int i = 1; i < tokens.size(); i++) { buf.append(tokens.get(i)); buf.append("."); } if (buf.charAt(buf.length() - 1) == '.') { buf.deleteCharAt(buf.length() - 1); buf.append("/"); } buf.append(tokens.get(0)); return buf.toString(); }
NamespaceUtils { public static String toNamespace(String packageName) { if (packageName == null || packageName.length() == 0) { return null; } List < String > tokens = reverse(tokenize(packageName, ".")); StringBuilder buf = new StringBuilder("http: for (int i = 1; i < tokens.size(); i++) { buf.append(tokens.get(i)); buf.append("."); } if (buf.charAt(buf.length() - 1) == '.') { buf.deleteCharAt(buf.length() - 1); buf.append("/"); } buf.append(tokens.get(0)); return buf.toString(); } }
NamespaceUtils { public static String toNamespace(String packageName) { if (packageName == null || packageName.length() == 0) { return null; } List < String > tokens = reverse(tokenize(packageName, ".")); StringBuilder buf = new StringBuilder("http: for (int i = 1; i < tokens.size(); i++) { buf.append(tokens.get(i)); buf.append("."); } if (buf.charAt(buf.length() - 1) == '.') { buf.deleteCharAt(buf.length() - 1); buf.append("/"); } buf.append(tokens.get(0)); return buf.toString(); } private  NamespaceUtils(); }
NamespaceUtils { public static String toNamespace(String packageName) { if (packageName == null || packageName.length() == 0) { return null; } List < String > tokens = reverse(tokenize(packageName, ".")); StringBuilder buf = new StringBuilder("http: for (int i = 1; i < tokens.size(); i++) { buf.append(tokens.get(i)); buf.append("."); } if (buf.charAt(buf.length() - 1) == '.') { buf.deleteCharAt(buf.length() - 1); buf.append("/"); } buf.append(tokens.get(0)); return buf.toString(); } private  NamespaceUtils(); static String toPackageName(String nsUri); static String toNamespace(String packageName); }
NamespaceUtils { public static String toNamespace(String packageName) { if (packageName == null || packageName.length() == 0) { return null; } List < String > tokens = reverse(tokenize(packageName, ".")); StringBuilder buf = new StringBuilder("http: for (int i = 1; i < tokens.size(); i++) { buf.append(tokens.get(i)); buf.append("."); } if (buf.charAt(buf.length() - 1) == '.') { buf.deleteCharAt(buf.length() - 1); buf.append("/"); } buf.append(tokens.get(0)); return buf.toString(); } private  NamespaceUtils(); static String toPackageName(String nsUri); static String toNamespace(String packageName);  }