/** * Returns the path of the given node, using {@code /} as the path delimiter. * * @see #path(com.diffplug.common.tree.TreeDef.Parented, Object, Function, String) */ public static <T> String path(TreeDef.Parented<T> treeDef, T node, Function<? super T, String> toString) { return path(treeDef, node, toString, "/"); }
/** * Returns the path of the given node, using {@code /} as the path delimiter and {@link Object#toString()} as the mapping function. * * @see #path(com.diffplug.common.tree.TreeDef.Parented, Object, Function, String) */ public static <T> String path(TreeDef.Parented<T> treeDef, T node) { return path(treeDef, node, Object::toString); }
/** Returns the path of this node, using the given {@code toString} method and {@code delimiter}. */ public String getPath(Function<? super T, String> toString, String delimiter) { requireNonNull(toString); requireNonNull(delimiter); return TreeQuery.path(treeDef(), this, node -> toString.apply(node.getContent()), delimiter); }