Class FilterFunction
java.lang.Object
com.api.jsonata4java.expressions.functions.FunctionBase
com.api.jsonata4java.expressions.functions.FilterFunction
From http://docs.jsonata.org/higher-order-functions#filter
Signature: $filter(array, function)
Returns an array containing only the values in the array parameter that
satisfy the function predicate (i.e. function returns Boolean true when
passed the value).
The function that is supplied as the second parameter must have the following
signature:
function(value [, index [, array]])
Each value in the input array is passed in as the first parameter in the
supplied function. The index (position) of that value in the input array is
passed in as the second parameter, if specified. The whole input array is
passed in as the third parameter, if specified.
Example The following expression returns all the products whose price is
higher than average:
$filter(Account.Order.Product, function($v, $i, $a) { $v.Price >
$average($a.Price) })
-
Nested Class Summary
Nested classes/interfaces inherited from class com.api.jsonata4java.expressions.functions.FunctionBase
FunctionBase.CtxEvalResult -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObject(ExpressionsVisitor.SelectorArrayNode result, com.fasterxml.jackson.databind.node.ObjectNode obj) intintcom.fasterxml.jackson.databind.JsonNodeinvoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx) Methods inherited from class com.api.jsonata4java.expressions.functions.FunctionBase
evalContext, getArgumentCount, getFunctionName
-
Field Details
-
ERR_BAD_CONTEXT
-
ERR_ARG1BADTYPE
-
ERR_ARG2BADTYPE
-
ERR_ARG3BADTYPE
-
ERR_ARG1_MUST_BE_ARRAY_OF_OBJECTS
-
-
Constructor Details
-
FilterFunction
public FilterFunction()
-
-
Method Details
-
invoke
public com.fasterxml.jackson.databind.JsonNode invoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx) - Specified by:
invokein classFunctionBase
-
getMaxArgs
public int getMaxArgs()- Specified by:
getMaxArgsin classFunctionBase
-
getMinArgs
public int getMinArgs()- Specified by:
getMinArgsin classFunctionBase
-
getSignature
- Specified by:
getSignaturein classFunctionBase
-
addObject
public void addObject(ExpressionsVisitor.SelectorArrayNode result, com.fasterxml.jackson.databind.node.ObjectNode obj)
-