Class StringPath
- java.lang.Object
-
- com.inductiveautomation.ignition.common.StringPath
-
- All Implemented Interfaces:
Path
,java.io.Serializable
,java.lang.Comparable<StringPath>
- Direct Known Subclasses:
StringPath.CaseSensitiveStringPath
public class StringPath extends java.lang.Object implements Path, java.lang.Comparable<StringPath>
A simple path based on string based path components. Comparisons are made in a case-insensitive manner.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StringPath.CaseSensitiveStringPath
A case-sensitive subclass ofStringPath
.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PATH_SEPARATOR
static StringPath
ROOT
An emptyStringPath
, i.e.-
Fields inherited from interface com.inductiveautomation.ignition.common.Path
SERIALIZATION_WHITELIST
-
-
Constructor Summary
Constructors Constructor Description StringPath(java.lang.String[] parts)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringPath.CaseSensitiveStringPath
caseSensitive()
Create a newStringPath.CaseSensitiveStringPath
that has the same parts as thisStringPath
.int
compareTo(StringPath that)
boolean
equals(java.lang.Object obj)
static StringPath
extend(StringPath parent, StringPath other)
static StringPath
extend(StringPath parent, java.lang.String... subparts)
static StringPath
from(TagPath path)
StringPath
getChildPath(java.lang.String... pathParts)
java.lang.String
getLastPathComponent()
Convenience function to return the last path element.StringPath
getParentPath()
Returns the parent, or null if at the root level.java.lang.String[]
getParts()
java.lang.String
getPathComponent(int i)
Returns the path element at the specified location.int
getPathLength()
Returns the number of elements in the path, which can be retrieved through getPathComponent().int
hashCode()
boolean
isAncestorOf(Path child)
Returns whether the provided path is a child path of this one.boolean
isParentOf(Path child)
boolean
isRoot()
static StringPath
of(java.lang.String... parts)
static StringPath
parse(java.lang.String value)
StringPath
subPath()
Returns the path, minus the first element.StringPath
subPath(int start, int len)
java.lang.String
toString()
-
-
-
Field Detail
-
ROOT
public static final StringPath ROOT
An emptyStringPath
, i.e. a path with zero components and zero length.
-
PATH_SEPARATOR
public static final java.lang.String PATH_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
getParts
public java.lang.String[] getParts()
-
of
public static StringPath of(java.lang.String... parts)
-
from
public static StringPath from(TagPath path)
-
parse
public static StringPath parse(java.lang.String value)
- Parameters:
value
- A path to parse, like "path/to/thing". Null will be treated like empty string: both will create a path of zero length.
-
extend
public static StringPath extend(StringPath parent, java.lang.String... subparts)
-
extend
public static StringPath extend(StringPath parent, StringPath other)
-
getPathLength
public int getPathLength()
Description copied from interface:Path
Returns the number of elements in the path, which can be retrieved through getPathComponent().- Specified by:
getPathLength
in interfacePath
-
subPath
public StringPath subPath()
Returns the path, minus the first element.
-
subPath
public StringPath subPath(int start, int len)
-
getParentPath
public StringPath getParentPath()
Returns the parent, or null if at the root level.- Specified by:
getParentPath
in interfacePath
-
getChildPath
public StringPath getChildPath(java.lang.String... pathParts)
-
getPathComponent
public java.lang.String getPathComponent(int i)
Description copied from interface:Path
Returns the path element at the specified location.- Specified by:
getPathComponent
in interfacePath
-
getLastPathComponent
public java.lang.String getLastPathComponent()
Description copied from interface:Path
Convenience function to return the last path element.- Specified by:
getLastPathComponent
in interfacePath
-
isRoot
public boolean isRoot()
- Returns:
- true if the path length is zero
-
isParentOf
public boolean isParentOf(Path child)
-
isAncestorOf
public boolean isAncestorOf(Path child)
Description copied from interface:Path
Returns whether the provided path is a child path of this one.- Specified by:
isAncestorOf
in interfacePath
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(StringPath that)
- Specified by:
compareTo
in interfacejava.lang.Comparable<StringPath>
-
caseSensitive
public StringPath.CaseSensitiveStringPath caseSensitive()
Create a newStringPath.CaseSensitiveStringPath
that has the same parts as thisStringPath
.- Returns:
- a
StringPath.CaseSensitiveStringPath
.
-
-