Class QualifiedPath

  • All Implemented Interfaces:

    public class QualifiedPath
    extends java.lang.Object
    implements, Path
    This class is a path to anything in Ignition, across any system. It dictates how the path is formed, but the actual meaning of different subcomponents will depend on the context in which the path is used.
    See Also:
    Serialized Form
    • Field Detail


        protected static final java.lang.String SUBPART_SEPERATOR
        See Also:
        Constant Field Values

        protected static final java.lang.String COMPONENTID_SEPERATOR
        See Also:
        Constant Field Values
    • Constructor Detail

      • QualifiedPath

        public QualifiedPath()
    • Method Detail

      • of

        public static QualifiedPath of​(java.lang.String... idValPairs)
        Creates a path out of the specified id/value pairs. The parameters must be in the form "id,value,id,value".
      • extend

        public QualifiedPath extend​(java.lang.String id,
                                    java.lang.String value)
        Returns a path with the provided component added on at the end.
      • prepend

        public QualifiedPath prepend​(java.lang.String id,
                                     java.lang.String value)
        Returns a new path with the provided component added at the beginning.
      • insert

        public QualifiedPath insert​(java.lang.String id,
                                    java.lang.String value,
                                    java.lang.String beforeComponentId)
        Locates the component specified and inserts the new component before it.
      • 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 interface Path
      • 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 interface Path
      • getLastPathComponent

        public java.lang.String getLastPathComponent()
        Description copied from interface: Path
        Convenience function to return the last path element.
        Specified by:
        getLastPathComponent in interface Path
      • getLastPathComponentId

        public java.lang.String getLastPathComponentId()
      • getFirstPathComponent

        public java.lang.String getFirstPathComponent()
      • getFirstPathComponentId

        public java.lang.String getFirstPathComponentId()
      • subpath

        public QualifiedPath subpath()
        Removes the first path component and returns the rest as a new path.
      • subpath

        public QualifiedPath subpath​(java.lang.String id)
        Returns the paths that comes after the first instance of the specified id.
        id - component id after which the subsequent path parts will be returned.
        everything after the specified id, or null if id is not found.
      • strip

        public QualifiedPath strip()
        Removes the last fully-qualified component from the path. This differs from getParentPath() in that that function doesn't care whether the component is qualified or not.
      • remove

        public QualifiedPath remove​(java.lang.String id)
        Removes the given component, if present.
      • replace

        public QualifiedPath replace​(java.lang.String id,
                                     java.lang.String value)
        If the component specified by the given id exists in the path, the value will be replaced with the new value.
      • indexOf

        protected int indexOf​(java.lang.String id)
      • getPathComponent

        public java.lang.String getPathComponent​(@Nullable
                                                 java.lang.String id)
      • getPathComponentOrElse

        public java.lang.String getPathComponentOrElse​(@Nullable
                                                       java.lang.String id,
                                                       java.lang.String orElse)
      • getPartsFor

        protected QualifiedPath.Part[] getPartsFor​(@Nullable
                                                   java.lang.String id)
        Returns all of the sub parts for a specified id, or null if they don't exist.
      • hasPathComponent

        public boolean hasPathComponent​(java.lang.String id)
      • getParentPath

        public QualifiedPath getParentPath()
        Description copied from interface: Path
        Returns a path representing the element above the current path.
        Specified by:
        getParentPath in interface Path
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • toStringSimple

        public java.lang.String toStringSimple()
        Returns the path in a friendlier to read form, without component ids.
      • 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 interface Path
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        equals in class java.lang.Object
      • parse

        public static QualifiedPath parse​(java.lang.String value)
        Attempts to parse the string into an QualifiedPath. IOException is thrown on invalid path.
      • parseSafe

        public static QualifiedPath parseSafe​(java.lang.String value)
        Same as parse(), but catches exceptions and returns null on bad paths.
      • parseSubParts

        protected static java.util.List<QualifiedPath.Part> parseSubParts​(java.lang.String id,
                                                                          java.lang.String value)
        Returns at least one part for the root, with id. If the value contains sub parts, those will be returned as well. The root part will have the sub part count set on it already.