public final class CanonicalPath extends Path implements Iterable<CanonicalPath>, Serializable
For description of the basic behavior and serialized form of the path, please consult Path.
| Modifier and Type | Class and Description |
|---|---|
static class |
CanonicalPath.Builder |
static class |
CanonicalPath.EnvironmentBuilder |
static class |
CanonicalPath.Extender |
static class |
CanonicalPath.FeedBuilder |
class |
CanonicalPath.IdExtractor |
static class |
CanonicalPath.MetadataPackBuilder |
static class |
CanonicalPath.MetricBuilder |
static class |
CanonicalPath.MetricTypeBuilder |
static class |
CanonicalPath.OperationTypeBuilder |
static class |
CanonicalPath.RelationshipBuilder |
static class |
CanonicalPath.ResourceBuilder |
static class |
CanonicalPath.ResourceTypeBuilder |
static class |
CanonicalPath.StructuredDataBuilder |
static class |
CanonicalPath.TenantBuilder |
Path.ExtenderConstructor, Path.HintedTypeProvider, Path.Segment, Path.StructuredDataHintingTypeProvider, Path.TypeProviderendIdx, path, PATH_DELIM, startIdx, TYPE_DELIM| Modifier and Type | Method and Description |
|---|---|
<R,P> R |
accept(ElementTypeVisitor<R,P> visitor,
P parameter) |
Iterator<CanonicalPath> |
ascendingIterator() |
Iterator<CanonicalPath> |
descendingIterator() |
CanonicalPath |
down()
If this path was created by going
up from another path, then this method can be used to go back
down to the previous paths representing some child resource of the resource represented by this path object. |
CanonicalPath |
down(int distance)
If this path was created by going
up from another path, then this method can be used to go back
down n steps to the previous paths representing some (grand-)child resource of the resource represented by
this path object. |
static CanonicalPath.Extender |
empty() |
CanonicalPath.Extender |
extend(SegmentType type,
String id)
Creates a new path by appending the provided segment to the current path.
|
static CanonicalPath |
fromPartiallyUntypedString(String path,
CanonicalPath initialPosition,
Class<?> intendedFinalType)
An overload of
Path.fromPartiallyUntypedString(String, TypeProvider) which uses the provided initial position
to figure out the possible type if is missing in the provided relative path. |
static CanonicalPath |
fromPartiallyUntypedString(String path,
CanonicalPath initialPosition,
SegmentType intendedFinalType) |
static CanonicalPath |
fromPartiallyUntypedString(String path,
Path.TypeProvider typeProvider) |
static CanonicalPath |
fromString(String path)
Creates a new path instance from the "serialized" slash-separated representation.
|
CanonicalPath |
getLeaf()
If this path was created by going
up from another path, then this returns the bottom-most path
in such chain. |
CanonicalPath |
getRoot() |
CanonicalPath.IdExtractor |
ids()
The path contains ids of different entities.
|
boolean |
isParentOf(CanonicalPath other) |
Iterator<CanonicalPath> |
iterator() |
CanonicalPath.Extender |
modified()
The returned extender will produce a modified version of this path.
|
protected CanonicalPath |
newInstance(int startIdx,
int endIdx,
List<Path.Segment> segments) |
static CanonicalPath.Builder |
of() |
RelativePath |
relativeTo(CanonicalPath root) |
CanonicalPath |
toCanonicalPath()
Tries to convert this path to a canonical path.
|
RelativePath |
toRelativePath()
Tries to convert this path to a relative path.
|
String |
toString() |
CanonicalPath |
up()
Returns a path corresponding to the direct ancestor of the resource represented by this path object.
|
CanonicalPath |
up(int distance)
Returns a path corresponding to the n-th ancestor in the hierarchy.
|
equals, fromPartiallyUntypedString, getDepth, getPath, getSegment, getTop, hashCode, isCanonical, isDefined, isParentOf, isRelativeclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static CanonicalPath.Extender empty()
public static CanonicalPath.Builder of()
public static CanonicalPath fromString(String path)
The escape character is '\' and special characters are '\', '|' and '/'.
path - the string representation of the pathpublic static CanonicalPath fromPartiallyUntypedString(String path, Path.TypeProvider typeProvider)
path - the canonical path to parsetypeProvider - the type provider used to figure out types of segments that don't explicitly mention itPath.fromPartiallyUntypedString(String, TypeProvider)public static CanonicalPath fromPartiallyUntypedString(String path, CanonicalPath initialPosition, Class<?> intendedFinalType)
Path.fromPartiallyUntypedString(String, TypeProvider) which uses the provided initial position
to figure out the possible type if is missing in the provided relative path.path - the relative path to parseinitialPosition - the initial position using which the types will be deduced for the segments that don't
specify the type explicitlyintendedFinalType - the type of the final segment in the path. This can resolve potentially ambiguous
situations where, given the initial position, more choices are possible.public static CanonicalPath fromPartiallyUntypedString(String path, CanonicalPath initialPosition, SegmentType intendedFinalType)
public <R,P> R accept(ElementTypeVisitor<R,P> visitor, P parameter)
public CanonicalPath toCanonicalPath()
PathtoCanonicalPath in class Pathpublic RelativePath toRelativePath()
PathtoRelativePath in class Pathpublic Iterator<CanonicalPath> ascendingIterator()
ascendingIterator in class Pathpublic Iterator<CanonicalPath> descendingIterator()
descendingIterator in class Pathpublic CanonicalPath down()
Pathup from another path, then this method can be used to go back
down to the previous paths representing some child resource of the resource represented by this path object.public CanonicalPath down(int distance)
Pathup from another path, then this method can be used to go back
down n steps to the previous paths representing some (grand-)child resource of the resource represented by
this path object.protected CanonicalPath newInstance(int startIdx, int endIdx, List<Path.Segment> segments)
newInstance in class Pathpublic CanonicalPath up()
Pathpublic CanonicalPath up(int distance)
Pathpublic CanonicalPath getRoot()
public CanonicalPath getLeaf()
up from another path, then this returns the bottom-most path
in such chain.public boolean isParentOf(CanonicalPath other)
public RelativePath relativeTo(CanonicalPath root)
public CanonicalPath.Extender extend(SegmentType type, String id)
The returned path will be the leaf path of the new path chain created by obtaining the segments of the
current path using Path.getPath() and appending the new segment to it.
It is checked that the new path is a valid canonical path. I.e. you cannot add a tenant segment under a resource, etc.
type - the type of the entity to appendid - the id of the appended entityIllegalArgumentException - if adding the provided segment would create an invalid canonical pathpublic CanonicalPath.Extender modified()
public CanonicalPath.IdExtractor ids()
Using the returned extractor, one can obtain the ids of such different entities easily.
public Iterator<CanonicalPath> iterator()
iterator in interface Iterable<CanonicalPath>Copyright © 2014–2016 Red Hat, Inc.. All rights reserved.