/** * @return path of this builder. */ public final String getPath() { return parent == null ? "/" : getPath(new StringBuilder()).toString(); }
/** * @return path of this builder. */ public final String getPath() { return parent == null ? "/" : getPath(new StringBuilder()).toString(); }
private StringBuilder getPath(StringBuilder parentPath) { return parent == null ? parentPath : parent.getPath(parentPath).append('/').append(name); }
private StringBuilder getPath(StringBuilder parentPath) { return parent == null ? parentPath : parent.getPath(parentPath).append('/').append(name); }
@Override public String toString() { return toStringHelper(this).add("path", builder.getPath()).toString(); } }
@Override public String toString() { return toStringHelper(this).add("path", builder.getPath()).toString(); } }
@Override public String toString() { return toStringHelper(this).add("path", getPath()).toString(); }
@Override public String toString() { return toStringHelper(this).add("path", builder.getPath()).toString(); } }
@Override public String toString() { return toStringHelper(this).add("path", builder.getPath()).toString(); } }
@Override public String toString() { return toStringHelper(this).add("path", getPath()).toString(); }
private final String getSourcePath() { // Traverse up the hierarchy until we encounter the first builder // having a source path annotation or until we hit the root MemoryNodeBuilder builder = this; String sourcePath = getSourcePathAnnotation(builder); while (sourcePath == null && builder.parent != null) { builder = builder.parent; sourcePath = getSourcePathAnnotation(builder); } if (sourcePath == null) { // Neither self nor any parent has a source path annotation. The source // path is just the path of this builder return getPath(); } else { // The source path is the source path of the first parent having a source // path annotation with the relative path from this builder up to that // parent appended. return PathUtils.concat(sourcePath, PathUtils.relativize(builder.getPath(), getPath())); } }
private final String getSourcePath() { // Traverse up the hierarchy until we encounter the first builder // having a source path annotation or until we hit the root MemoryNodeBuilder builder = this; String sourcePath = getSourcePathAnnotation(builder); while (sourcePath == null && builder.parent != null) { builder = builder.parent; sourcePath = getSourcePathAnnotation(builder); } if (sourcePath == null) { // Neither self nor any parent has a source path annotation. The source // path is just the path of this builder return getPath(); } else { // The source path is the source path of the first parent having a source // path annotation with the relative path from this builder up to that // parent appended. return PathUtils.concat(sourcePath, PathUtils.relativize(builder.getPath(), getPath())); } }