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 classStringPath.CaseSensitiveStringPathA case-sensitive subclass ofStringPath.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPATH_RELATIVEstatic java.lang.StringPATH_RELATIVE_UPstatic java.lang.StringPATH_SEPARATORstatic StringPathROOTAn 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.CaseSensitiveStringPathcaseSensitive()Create a newStringPath.CaseSensitiveStringPaththat has the same parts as thisStringPath.intcompareTo(StringPath that)booleanequals(java.lang.Object obj)static StringPathextend(StringPath parent, StringPath other)static StringPathextend(StringPath parent, java.lang.String... subparts)static StringPathfrom(TagPath path)StringPathgetChildPath(java.lang.String... pathParts)java.lang.StringgetLastPathComponent()Convenience function to return the last path element.StringPathgetParentPath()Returns the parent, or null if at the root level.java.lang.String[]getParts()java.lang.StringgetPathComponent(int i)Returns the path element at the specified location.intgetPathLength()Returns the number of elements in the path, which can be retrieved through getPathComponent().inthashCode()booleanisAncestorOf(Path child)Returns whether the provided path is a child path of this one.booleanisParentOf(Path child)static booleanisRelative(StringPath path)booleanisRoot()static StringPathmakeRelative(StringPath toRelative, StringPath root)static StringPathof(java.lang.String... parts)static StringPathparse(java.lang.String value)static StringPathremoveRelative(StringPath relative, StringPath root)StringPathsubPath()Returns the path, minus the first element.StringPathsubPath(int start, int len)java.lang.StringtoString()
-
-
-
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
-
PATH_RELATIVE
public static final java.lang.String PATH_RELATIVE
- See Also:
- Constant Field Values
-
PATH_RELATIVE_UP
public static final java.lang.String PATH_RELATIVE_UP
- 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)
-
makeRelative
public static StringPath makeRelative(StringPath toRelative, StringPath root)
-
isRelative
public static boolean isRelative(StringPath path)
-
removeRelative
public static StringPath removeRelative(StringPath relative, StringPath root)
-
getPathLength
public int getPathLength()
Description copied from interface:PathReturns the number of elements in the path, which can be retrieved through getPathComponent().- Specified by:
getPathLengthin 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:
getParentPathin interfacePath
-
getChildPath
public StringPath getChildPath(java.lang.String... pathParts)
-
getPathComponent
public java.lang.String getPathComponent(int i)
Description copied from interface:PathReturns the path element at the specified location.- Specified by:
getPathComponentin interfacePath
-
getLastPathComponent
public java.lang.String getLastPathComponent()
Description copied from interface:PathConvenience function to return the last path element.- Specified by:
getLastPathComponentin 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:PathReturns whether the provided path is a child path of this one.- Specified by:
isAncestorOfin interfacePath
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(StringPath that)
- Specified by:
compareToin interfacejava.lang.Comparable<StringPath>
-
caseSensitive
public StringPath.CaseSensitiveStringPath caseSensitive()
Create a newStringPath.CaseSensitiveStringPaththat has the same parts as thisStringPath.- Returns:
- a
StringPath.CaseSensitiveStringPath.
-
-