diff --git a/src/main/java/li/strolch/model/Locator.java b/src/main/java/li/strolch/model/Locator.java index 0dd9f093c..5e60f9852 100644 --- a/src/main/java/li/strolch/model/Locator.java +++ b/src/main/java/li/strolch/model/Locator.java @@ -274,6 +274,18 @@ public class Locator { return new Locator(path); } + /** + * Creates a new {@link LocatorBuilder} instance and appends the given elements to it + * + * @param path + * the first element on the {@link Locator} + * + * @return a new {@link LocatorBuilder} instance with the given root element tag as the first element + */ + public static LocatorBuilder newBuilder(String... path) { + return new LocatorBuilder().append(path); + } + /** * Creates a new {@link LocatorBuilder} instance and appends the given root element tag to it * @@ -303,6 +315,21 @@ public class Locator { this.pathElements = new ArrayList(); } + /** + * Append the given elements to the path + * + * @param path + * the path elements to add + * + * @return this instance for chaining + */ + public LocatorBuilder append(String... path) { + for (String element : path) { + this.pathElements.add(element); + } + return this; + } + /** * Append an element to the path *