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())); } }