Class Length
java.lang.Object
com.jayway.jsonpath.internal.function.text.Length
- All Implemented Interfaces:
PathFunction
Provides the length of a JSONArray Object
Created by mattg on 6/26/15.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
TOKEN_NAME
- See Also:
-
-
Constructor Details
-
Length
public Length()
-
-
Method Details
-
invoke
public Object invoke(String currentPath, PathRef parent, Object model, EvaluationContext ctx, List<Parameter> parameters) When we calculate the length of a path, what we're asking is given the node we land on how many children does it have. Thus when we wrote the original query what we really wanted was $..book.length() or $.length($..book.*)- Specified by:
invokein interfacePathFunction- Parameters:
currentPath- The current path location inclusive of the function nameparent- The path location above the current functionmodel- The JSON model as input to this particular functionctx- Eval context, state bag used as the path is traversed, maintains the result of executingparameters-- Returns:
-