public interface ItemPath extends ShortDumpable, Serializable
Modifier and Type | Interface and Description |
---|---|
static class |
ItemPath.CompareResult |
Modifier and Type | Field and Description |
---|---|
static ItemPath |
EMPTY_PATH |
Modifier and Type | Method and Description |
---|---|
ItemPath |
allExceptLast()
Returns all segments except the last one.
|
default ItemPath |
allUpToIncluding(int i)
Returns all segments up to the specified one (including it).
|
default ItemPath |
allUpToLastName()
Returns all segments up to the last named one (excluding).
|
default ItemPath |
append(Object... components)
Returns a newly created path containing all the segments of this path with added components.
|
default QName |
asSingleName()
If the path consists of a single name segment (not variable nor special symbol), returns the corresponding value.
|
default ItemName |
asSingleNameOrFail()
If the path consists of a single name segment (not variable nor special symbol), returns the corresponding value.
|
static void |
checkNoSpecialSymbols(ItemPath path) |
static void |
checkNoSpecialSymbolsExceptParent(ItemPath path) |
default ItemPath.CompareResult |
compareComplex(ItemPath otherPath)
Compares two item paths.
|
default boolean |
containsNameExactly(QName name)
Returns true if the path contains the specified name (requires exact match).
|
default boolean |
containsSpecialSymbols() |
default boolean |
containsSpecialSymbolsExceptParent() |
static ItemPath |
create(List<?> components)
Creates the path from given components.
|
static ItemPath |
create(Object... components)
Creates the path from given components.
|
static ItemPath |
createReverse(List<?> components)
Creates the path from given components in reverse direction.
|
static ItemPath |
emptyIfNull(ItemPath path)
Converts null ItemPath to empty one.
|
default boolean |
equals(Object other,
boolean exact)
Compares with the other object either literally (exact = true) or via .equivalent (exact = false).
|
default boolean |
equivalent(ItemPath path)
Checks if the paths are equivalent.
|
static boolean |
equivalent(ItemPath path1,
ItemPath path2) |
Object |
first()
Returns the first segment or null if the path is empty.
|
ItemPath |
firstAsPath()
Returns the first segment as an ItemPath.
|
default ItemName |
firstName()
Returns the value of the first name segment or null if there's no name segment.
|
default int |
firstNameIndex()
Returns the first name segment index; or -1 if there's no such segment.
|
default ItemName |
firstNameOrFail()
The same as firstName but throws an exception if there's no name.
|
default Long |
firstToId()
Returns the value of the first segment if it is a Id segment; otherwise throws an exception.
|
default Long |
firstToIdOrNull()
Returns the value of the first segment if it is a Id segment; otherwise null.
|
static Long |
firstToIdOrNull(ItemPath path) |
default ItemName |
firstToName()
Returns the value of the first segment if it is a name segment; otherwise null.
|
default ItemName |
firstToNameOrNull()
Returns the value of the first segment if it is a name segment; otherwise null.
|
static ItemName |
firstToNameOrNull(ItemPath itemPath) |
default QName |
firstToVariableNameOrNull()
Returns the value of the first segment if it is a variable name segment; otherwise null.
|
Object |
getSegment(int i)
Returns the given path segment.
|
List<?> |
getSegments()
Returns the path segments.
|
boolean |
isEmpty()
Returns true if the path is empty i.e.
|
static boolean |
isEmpty(ItemPath path)
Returns true if the path is null or empty.
|
static boolean |
isId(Object o)
Returns true if the segment is the container Id.
|
static boolean |
isIdentifier(Object segment)
Returns true if the segment is the Identifier one ("#").
|
static boolean |
isName(Object segment)
Returns true if the segment is a name segment.
|
static boolean |
isNullId(Object o)
Returns true if the segment is the container Id with value of NULL.
|
static boolean |
isObjectReference(Object segment)
Returns true if the segment is the Object Reference one ("@").
|
static boolean |
isParent(Object segment)
Returns true if the segment is the Parent one ("..").
|
default boolean |
isSingleName()
Returns true if the path consists of a single name segment.
|
static boolean |
isSpecial(Object segment)
Returns true if the segment is a special one: parent, reference, identifier, variable.
|
default boolean |
isSubPath(ItemPath otherPath)
Checks if current path is a strict subpath (prefix) of the other path.
|
default boolean |
isSubPathOrEquivalent(ItemPath otherPath)
Check if current path is a subpath (prefix) of the other path or they are equivalent.
|
default boolean |
isSuperPath(ItemPath otherPath)
Check if the other path is a strict subpath (prefix) of this path.
|
default boolean |
isSuperPathOrEquivalent(ItemPath path)
Check if the other path is a subpath (prefix) of this path or they are equivalent.
|
static boolean |
isVariable(Object segment)
Returns true if the segment is the Variable one ("$...").
|
Object |
last()
Returns the last segment (or null if the path is empty).
|
ItemName |
lastName()
Returns the last name segment value; or null if there's no name segment.
|
default int |
lastNameIndex()
Returns the last name segment index; or -1 if there's no such segment.
|
ItemPath |
namedSegmentsOnly()
Returns the path containing only the regular named segments.
|
default ItemPath |
remainder(ItemPath path)
Returns the remainder of "this" path after passing all segments from the other path.
|
ItemPath |
removeIds()
Returns the path with no Id segments.
|
default ItemPath |
rest()
Returns the rest of the path (the tail).
|
ItemPath |
rest(int n)
Returns the rest of the path (the tail), starting at position "n".
|
static boolean |
segmentsEquivalent(Object segment1,
Object segment2)
Returns true if the given segments are equivalent.
|
default void |
shortDump(StringBuilder sb)
Show the content of the object intended for diagnostics.
|
int |
size()
Returns path size i.e.
|
default boolean |
startsWith(ItemPath prefix)
Convenience method with understandable semantics.
|
default boolean |
startsWithId()
Returns true if the path starts with with value Id.
|
default boolean |
startsWithIdentifier()
Returns true if the path starts with an identifier (#).
|
default boolean |
startsWithName()
Returns true if the path starts with the standard segment name (i.e.
|
default boolean |
startsWithName(QName name)
Returns true if the path starts with the specified name (approximate match).
|
default boolean |
startsWithNullId()
Returns true if the path starts with the value Id of null.
|
default boolean |
startsWithObjectReference()
Returns true if the path starts with an object reference (@).
|
default boolean |
startsWithParent()
Returns true if the path starts with a parent segment (..).
|
default boolean |
startsWithVariable()
Returns true if the path starts with variable name ($...).
|
default ItemPath |
stripVariableSegment()
Removes the leading variable segment, if present.
|
ItemPath |
subPath(int from,
int to)
Returns a sub-path from (including) to (excluding) given indices.
|
static Long |
toId(Object segment)
Returns a Long value corresponding to the container Id segment, or throw an exception otherwise.
|
static Long |
toIdOrNull(Object segment)
Returns a Long value corresponding to the container Id segment, or return null otherwise.
|
static ItemName |
toName(Object segment)
Returns a name corresponding to the name segment, or throw an exception otherwise.
|
static QName |
toNameNullSafe(Object segment)
Returns a name corresponding to the name segment, or throw an exception otherwise.
|
static ItemName |
toNameOrNull(Object segment)
Returns a name corresponding to the name segment, or null if it's no name.
|
static QName |
toVariableName(Object segment)
Returns a name corresponding to the Variable segment, or throw an exception otherwise.
|
shortDump, shortDumpLazily
static final ItemPath EMPTY_PATH
@NotNull static ItemPath create(Object... components)
@NotNull static ItemPath create(@NotNull List<?> components)
create(Object...)
@NotNull static ItemPath createReverse(@NotNull List<?> components)
boolean isEmpty()
static boolean isEmpty(ItemPath path)
int size()
@NotNull default ItemPath append(Object... components)
@NotNull List<?> getSegments()
@Nullable Object getSegment(int i)
IndexOutOfBoundsException
- if the index is out of rangedefault ItemPath.CompareResult compareComplex(@Nullable ItemPath otherPath)
default boolean equivalent(ItemPath path)
default boolean equals(Object other, boolean exact)
default boolean isSubPath(ItemPath otherPath)
default boolean isSubPathOrEquivalent(ItemPath otherPath)
default boolean isSuperPath(ItemPath otherPath)
default boolean isSuperPathOrEquivalent(ItemPath path)
default boolean startsWith(ItemPath prefix)
static boolean isName(Object segment)
@NotNull static ItemName toName(Object segment)
@Nullable static QName toNameNullSafe(@Nullable Object segment)
@Nullable static ItemName toNameOrNull(Object segment)
static boolean isId(Object o)
static boolean isNullId(Object o)
static Long toId(Object segment)
static Long toIdOrNull(Object segment)
static boolean isSpecial(Object segment)
static boolean isParent(Object segment)
static boolean isObjectReference(Object segment)
static boolean isIdentifier(Object segment)
static boolean isVariable(Object segment)
static QName toVariableName(Object segment)
@Nullable Object first()
@NotNull default ItemPath rest()
@NotNull ItemPath rest(int n)
ItemPath firstAsPath()
default ItemPath remainder(ItemPath path)
@Nullable Object last()
@NotNull ItemPath allExceptLast()
default ItemPath allUpToIncluding(int i)
@NotNull default ItemPath allUpToLastName()
ItemPath subPath(int from, int to)
default boolean startsWithName()
default boolean startsWithId()
default boolean startsWithNullId()
default boolean startsWithIdentifier()
default boolean startsWithVariable()
default boolean startsWithObjectReference()
default boolean startsWithParent()
default QName asSingleName()
@NotNull default ItemName asSingleNameOrFail()
default boolean isSingleName()
@NotNull default ItemName firstToName()
@Nullable default ItemName firstToNameOrNull()
default QName firstToVariableNameOrNull()
default Long firstToId()
default Long firstToIdOrNull()
@Nullable default ItemName firstName()
@NotNull default ItemName firstNameOrFail()
default int firstNameIndex()
ItemName lastName()
default int lastNameIndex()
static void checkNoSpecialSymbols(ItemPath path)
static void checkNoSpecialSymbolsExceptParent(ItemPath path)
default boolean containsSpecialSymbols()
default boolean containsSpecialSymbolsExceptParent()
@NotNull ItemPath namedSegmentsOnly()
@NotNull ItemPath removeIds()
@NotNull default ItemPath stripVariableSegment()
default boolean containsNameExactly(QName name)
default boolean startsWithName(QName name)
static boolean segmentsEquivalent(Object segment1, Object segment2)
default void shortDump(StringBuilder sb)
ShortDumpable
shortDump
in interface ShortDumpable
sb
- StringBuilder to which to a compact one-line content of the object intended
for diagnostics by system administrator should be appended.Copyright © 2020 Evolveum. All rights reserved.