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.SerializableA 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 JsonPathcreateChildPath(int index)JsonPathcreateChildPath(JsonPath subElement)For creating subpaths, will return a cloned element with this as the new parent.JsonPathcreateChildPath(java.lang.String childKey)booleanequals(java.lang.Object obj)java.util.LinkedList<JsonPath>getAsLinkedList()intgetDepth()java.lang.ObjectgetKey()JsonPathgetParent()JsonPath[]getPathElements()Returns the elements in this path's parent chain in order from ROOT downwardsprotected java.lang.StringgetStringPathPart()JsonPathgetSubPath(int startingDepth)inthashCode()booleanisAncestorOf(JsonPath element)booleanisRelatedTo(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 pathbooleanisRoot()static booleanisValidIdentifier(java.lang.String test)static JsonPathparse(java.lang.String path)java.lang.StringtoString()
-
-
-
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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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:
toStringin classjava.lang.Object
-
parse
public static JsonPath parse(java.lang.String path)
-
-