private void constructPathString(StringBuilder sb, String separator) { if (_parent != null) { _parent.constructPathString(sb, separator); // We don't want to add the separator character after the windows network root; otherwise // we want to add the separator in before adding in our name if (!(_parent instanceof ResourcePathHead && _parent.getName().equals(WINDOWS_NETWORK_ROOT))) { sb.append(separator); } } sb.append(_name); }
/** * Returns the path string for this path using the specified path separator. The path * constructed will begin with the root of the path, which will be one of: * <ul> * <li>A windows drive letter, normalized to upper case, followed by : and the separator</li> * <li>The windows network path start \\</li> * <li>Just the separator, in the case of the unix root</li> * </ul> * After the path root will follow all path components, separated with the given separator. The * separator will not be appended to the end of the path. Some example paths returned by this * method are: * <ul> * <li>C:\temp\downloads</li> * <li>/</li> * <li>\\files\documents</li> * <ul> * * @param separator the separator to use when constructing the path * @return the path string for this path using the specified path separator */ public String getPathString(String separator) { StringBuilder sb = new StringBuilder(); constructPathString(sb, separator); return sb.toString(); }
private void constructPathString(StringBuilder sb, String separator) { if (_parent != null) { _parent.constructPathString(sb, separator); // We don't want to add the separator character after the windows network root; otherwise // we want to add the separator in before adding in our name if (!(_parent instanceof ResourcePathHead && _parent.getName().equals(WINDOWS_NETWORK_ROOT))) { sb.append(separator); } } sb.append(_name); }
/** * Returns the path string for this path using the specified path separator. The path * constructed will begin with the root of the path, which will be one of: * <ul> * <li>A windows drive letter, normalized to upper case, followed by : and the separator</li> * <li>The windows network path start \\</li> * <li>Just the separator, in the case of the unix root</li> * </ul> * After the path root will follow all path components, separated with the given separator. The * separator will not be appended to the end of the path. Some example paths returned by this * method are: * <ul> * <li>C:\temp\downloads</li> * <li>/</li> * <li>\\files\documents</li> * <ul> * * @param separator the separator to use when constructing the path * @return the path string for this path using the specified path separator */ public String getPathString(String separator) { StringBuilder sb = new StringBuilder(); constructPathString(sb, separator); return sb.toString(); }