Class QualifiedPath

java.lang.Object
com.inductiveautomation.ignition.common.QualifiedPath
All Implemented Interfaces:
Path, Serializable

public class QualifiedPath extends Object implements Serializable, 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:
  • Field Details

  • Constructor Details

    • QualifiedPath

      public QualifiedPath()
  • Method Details

    • clone

      public QualifiedPath clone()
      Overrides:
      clone in class Object
    • of

      public static QualifiedPath of(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(String id, String value)
      Returns a path with the provided component added on at the end.
    • prepend

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

      public QualifiedPath insert(String id, String value, 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
    • getPart

      @Nullable public QualifiedPath.Part getPart(int i)
    • getPathComponent

      public 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 String getLastPathComponent()
      Description copied from interface: Path
      Convenience function to return the last path element.
      Specified by:
      getLastPathComponent in interface Path
    • getLastPathComponentId

      @Nullable public String getLastPathComponentId()
    • getFirstPathComponent

      public String getFirstPathComponent()
    • getFirstPathComponentId

      public String getFirstPathComponentId()
    • subpath

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

      public QualifiedPath subpath(String id)
      Returns the paths that comes after the first instance of the specified id.
      Parameters:
      id - component id after which the subsequent path parts will be returned.
      Returns:
      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(String id)
      Removes the given component, if present.
    • replace

      public QualifiedPath replace(String id, 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(String id)
    • getPathComponent

      @Nullable public String getPathComponent(@Nullable String id)
    • getPathComponentOrElse

      @Nonnull public String getPathComponentOrElse(@Nullable String id, @Nonnull String orElse)
    • getPartsFor

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

      public boolean hasPathComponent(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

      @Nonnull public String toString()
      Overrides:
      toString in class Object
    • toStringSimple

      @Nonnull public 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()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • parse

      public static QualifiedPath parse(String value) throws IOException
      Attempts to parse the string into an QualifiedPath. IOException is thrown on invalid path.
      Throws:
      IOException
    • parseSafe

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

      protected static List<QualifiedPath.Part> parseSubParts(String id, 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.