Class JsonPath
- java.lang.Object
-
- com.inductiveautomation.ignition.common.JsonPath
-
- All Implemented Interfaces:
java.io.Serializable
public class JsonPath extends java.lang.Object implements java.io.Serializable
A property path represents a location in a JSON document. For example: foo.bar[5].bazImplemented as a singly-linked list where each PropertyPath represents one part of the path, linked to its parent.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonPath
createChildPath(int index)
JsonPath
createChildPath(JsonPath subElement)
For creating subpaths, will return a cloned element with this as the new parent.JsonPath
createChildPath(java.lang.String childKey)
boolean
equals(java.lang.Object obj)
java.util.LinkedList<JsonPath>
getAsLinkedList()
int
getDepth()
java.lang.Object
getKey()
JsonPath
getParent()
JsonPath[]
getPathElements()
Returns the elements in this path's parent chain in order from ROOT downwardsprotected java.lang.String
getStringPathPart()
JsonPath
getSubPath(int startingDepth)
int
hashCode()
boolean
isAncestorOf(JsonPath element)
boolean
isRelatedTo(JsonPath other)
Returns true if any of the following are true: This path is equal to the given path This path is an ancestor of the given path The given path is an ancestor of this pathboolean
isRoot()
static boolean
isValidIdentifier(java.lang.String test)
static JsonPath
parse(java.lang.String path)
java.lang.String
toString()
-
-
-
Field Detail
-
ROOT
public static final JsonPath ROOT
Special path which represents the root of all paths. Is the ancestor of any path except itself. For example, this would be the parent of the path "foo"
-
-
Method Detail
-
isRoot
public boolean isRoot()
-
getDepth
public int getDepth()
-
getKey
public java.lang.Object getKey()
-
getStringPathPart
protected java.lang.String getStringPathPart()
-
getParent
public JsonPath getParent()
-
getPathElements
public JsonPath[] getPathElements()
Returns the elements in this path's parent chain in order from ROOT downwards
-
getAsLinkedList
public java.util.LinkedList<JsonPath> getAsLinkedList()
-
getSubPath
public JsonPath getSubPath(int startingDepth)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
isAncestorOf
public boolean isAncestorOf(JsonPath element)
-
isRelatedTo
public boolean isRelatedTo(JsonPath other)
Returns true if any of the following are true:- This path is equal to the given path
- This path is an ancestor of the given path
- The given path is an ancestor of this path
-
isValidIdentifier
public static boolean isValidIdentifier(java.lang.String test)
-
createChildPath
public JsonPath createChildPath(java.lang.String childKey)
-
createChildPath
public JsonPath createChildPath(int index)
-
createChildPath
public JsonPath createChildPath(JsonPath subElement)
For creating subpaths, will return a cloned element with this as the new parent.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
parse
public static JsonPath parse(java.lang.String path)
-
-