@FunctionalInterface public interface TypedZPath<T>
Abstraction that allows the construction of ZPaths using strongly typed parameter replacements.
For example, given a path such as "/root/registry/people/{id}" where "id" should be PersonId
.
TypedZPath<PersonId> typedPath = TypedZPath.from("/root/registry/people/{id}");
...
ZPath path = typedPath.resolved(personId);
Additionally, if you have a model/class that implements NodeName
you can pass that when resolving. E.g.
public class MyModel implements NodeName {
...
public String nodeName() {
return modelId;
}
}
TypedZPath<MyModel> typedPath = TypedZPath.from("/foo/bar/{id}");
MyModel model = ...
ZPath path = typedPath.resolved(model);
Modifier and Type | Method and Description |
---|---|
static <T> TypedZPath<T> |
from(String pathWithIds)
Return a TypedZPath using
ZPath.parseWithIds(java.lang.String) |
static <T> TypedZPath<T> |
from(ZPath path)
Return a TypedZPath
|
ZPath |
resolved(T p1)
Resolve into a ZPath using the given parameter
|
ZPath resolved(T p1)
p1
- the parameterstatic <T> TypedZPath<T> from(String pathWithIds)
ZPath.parseWithIds(java.lang.String)
pathWithIds
- path to pass to ZPath.parseWithIds(java.lang.String)
static <T> TypedZPath<T> from(ZPath path)
path
- path to useCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.