[New] Added convenience method Locator.newLocatorBuilder(String...)
This commit is contained in:
parent
453b6b5bcb
commit
c7a69dbf88
|
@ -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<String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue