Class ResultPath
java.lang.Object
graphql.execution.ResultPath
As a graphql query is executed, each field forms a hierarchical path from parent field to child field and this
class represents that path as a series of segments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate final ResultPathprivate static final ResultPathprivate final Object -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivateResultPath(ResultPath parent, int segment) privateResultPath(ResultPath parent, String segment) -
Method Summary
Modifier and TypeMethodDescriptionappend(ResultPath path) Appends the provided path to the current oneDrops the last segment off the pathbooleanstatic ResultPathThis will create an execution path from the list of objectsintgetLevel()intinthashCode()booleanbooleanbooleanprivate static StringmkErrMsg()static ResultPathParses an execution path from the provided path string in the format /segment1/segment2[index]/segmentNreplaceSegment(int segment) Replaces the last segment on the path eg ResultPath.parse("/a/b[1]").replaceSegment(9) equals "/a/b[9]"replaceSegment(String segment) Replaces the last segment on the path eg ResultPath.parse("/a/b[1]").replaceSegment("x") equals "/a/b/x"static ResultPathrootPath()All paths start from heresegment(int segment) Takes the current path and adds a new segment to it, returning a new pathTakes the current path and adds a new segment to it, returning a new pathsibling(int siblingField) toList()toString()
-
Field Details
-
ROOT_PATH
-
parent
-
segment
-
hash
private int hash
-
-
Constructor Details
-
ResultPath
private ResultPath() -
ResultPath
-
ResultPath
-
-
Method Details
-
rootPath
-
getLevel
public int getLevel() -
getPathWithoutListEnd
-
isListSegment
public boolean isListSegment()- Returns:
- true if the end of the path has a list style segment eg 'a/b[2]'
-
isNamedSegment
public boolean isNamedSegment()- Returns:
- true if the end of the path has a named style segment eg 'a/b[2]/c'
-
getSegmentName
-
getSegmentIndex
public int getSegmentIndex() -
getSegmentValue
-
getParent
-
parse
Parses an execution path from the provided path string in the format /segment1/segment2[index]/segmentN- Parameters:
pathString- the path string- Returns:
- a parsed execution path
-
fromList
This will create an execution path from the list of objects- Parameters:
objects- the path objects- Returns:
- a new execution path
-
mkErrMsg
-
segment
Takes the current path and adds a new segment to it, returning a new path- Parameters:
segment- the string path segment to add- Returns:
- a new path containing that segment
-
segment
Takes the current path and adds a new segment to it, returning a new path- Parameters:
segment- the int path segment to add- Returns:
- a new path containing that segment
-
dropSegment
Drops the last segment off the path- Returns:
- a new path with the last segment dropped off
-
replaceSegment
Replaces the last segment on the path eg ResultPath.parse("/a/b[1]").replaceSegment(9) equals "/a/b[9]"- Parameters:
segment- the integer segment to use- Returns:
- a new path with the last segment replaced
-
replaceSegment
Replaces the last segment on the path eg ResultPath.parse("/a/b[1]").replaceSegment("x") equals "/a/b/x"- Parameters:
segment- the string segment to use- Returns:
- a new path with the last segment replaced
-
isRootPath
public boolean isRootPath()- Returns:
- true if the path is the
rootPath()
-
append
Appends the provided path to the current one- Parameters:
path- the path to append- Returns:
- a new path
-
sibling
-
sibling
-
toList
-
getKeysOnly
-
toString
-
segmentToString
-
equals
-
hashCode
-