public class FunctionUtils extends Object
| Constructor and Description |
|---|
FunctionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static MappingExpressionParser.ExprValuesContext |
addArrayExprVarContext(MappingExpressionParser.ExprContext ctx,
MappingExpressionParser.ExprValuesContext evc,
com.fasterxml.jackson.databind.node.ArrayNode arrayNode)
Extends a supplied
MappingExpressionParser.ExprValuesContext using the supplied context and
array node content |
static MappingExpressionParser.ExprValuesContext |
addIndexExprVarContext(MappingExpressionParser.ExprContext ctx,
MappingExpressionParser.ExprValuesContext evc,
Integer index)
Extends an
MappingExpressionParser.ExprValuesContext using the context containing the
supplied index value |
static MappingExpressionParser.ExprValuesContext |
addObjectExprVarContext(MappingExpressionParser.ExprContext ctx,
MappingExpressionParser.ExprValuesContext evc,
com.fasterxml.jackson.databind.node.ObjectNode object)
Extends an
MappingExpressionParser.ExprValuesContext using the context containing the
supplied object value |
static MappingExpressionParser.ExprValuesContext |
addStringExprVarContext(MappingExpressionParser.ExprContext ctx,
MappingExpressionParser.ExprValuesContext evc,
String string)
Extends an
MappingExpressionParser.ExprValuesContext using the context containing the
supplied string value |
static boolean |
checkArgument(ExpressionsVisitor exprVisitor,
MappingExpressionParser.ExprContext exprCtx,
String signature)
Tests whether the supplied exprCtx meets the signature expectations.
|
static MappingExpressionParser.ExprValuesContext |
fillExprVarContext(int fctVarCount,
MappingExpressionParser.ExprContext ctx,
com.fasterxml.jackson.databind.JsonNode... elements)
Creates an
MappingExpressionParser.ExprValuesContext containing a parenthesized comma
separated variable list of the supplied elements |
static MappingExpressionParser.ExprValuesContext |
fillExprVarContext(MappingExpressionParser.ExprContext ctx,
String key,
com.fasterxml.jackson.databind.JsonNode value)
Sets up the
MappingExpressionParser.ExprValuesContext variables for the function($v,$k)
signature used in each call for pairs of values and keys |
static MappingExpressionParser.Array_constructorContext |
getArrayConstructorContext(MappingExpressionParser.ExprContext ctx,
com.fasterxml.jackson.databind.node.ArrayNode array)
Creates an
MappingExpressionParser.Array_constructorContext from the supplied context and
array |
static com.fasterxml.jackson.databind.JsonNode |
getContextVariable(ExpressionsVisitor exprVisitor)
Retrieve the latest context variable from the
ExpressionsVisitor
stack, allowing for a null to be returned (in lieu of a NullNode) |
static com.fasterxml.jackson.databind.JsonNode |
getContextVariableOrNullNode(ExpressionsVisitor exprVisitor)
Retrieve the latest context variable from the
ExpressionsVisitor
stack |
static MappingExpressionParser.Object_constructorContext |
getObjectConstructorContext(MappingExpressionParser.ExprContext ctx,
com.fasterxml.jackson.databind.node.ObjectNode object)
Creates an
MappingExpressionParser.Object_constructorContext from the supplied context and
object |
static com.fasterxml.jackson.databind.JsonNode |
getValuesListExpression(ExpressionsVisitor exprVisitor,
MappingExpressionParser.Function_callContext ctx,
int index)
Gets the expression at the supplied index from the context's
MappingExpressionParser.ExprValuesContext MappingExpressionParser.ExprListContext, preserving the null value
(or returning null if the index is invalid) |
static com.fasterxml.jackson.databind.JsonNode |
getValuesListExpressionOrNullNode(ExpressionsVisitor exprVisitor,
MappingExpressionParser.Function_callContext ctx,
int index)
Gets the expression at the supplied index from the context's {link
ExprValuesContext} {link ExprListContext]
|
static com.fasterxml.jackson.databind.JsonNode |
processFctCallVariables(ExpressionsVisitor exprVisitor,
Function function,
org.antlr.v4.runtime.tree.TerminalNode varid,
MappingExpressionParser.Function_callContext ctx,
com.fasterxml.jackson.databind.JsonNode value,
String key,
com.fasterxml.jackson.databind.node.ObjectNode object)
Creates an
MappingExpressionParser.ExprListContext containing the parenthesized comma
separated variable list of JsonNode elements, sets it in the supplied context
(ctx) and then executes the function to return its result. |
static com.fasterxml.jackson.databind.JsonNode |
processVariablesCallFunction(ExpressionsVisitor exprVisitor,
Function function,
org.antlr.v4.runtime.tree.TerminalNode varid,
MappingExpressionParser.Function_callContext ctx,
com.fasterxml.jackson.databind.JsonNode... elements)
Creates an
MappingExpressionParser.ExprListContext containing the parenthesized comma
separated variable list of JsonNode elements, sets it in the supplied context
(ctx) and then executes the function to return its result. |
static boolean |
useContextVariable(Function fct,
MappingExpressionParser.Function_callContext ctx,
String signature)
Determine if the function should use the context variable as its first
parameter
|
static void |
validateArguments(String possibleException,
ExpressionsVisitor exprVisitor,
MappingExpressionParser.Function_callContext ctx,
int index,
String signature)
Checks the expression at the supplied index from the context's
MappingExpressionParser.ExprValuesContext MappingExpressionParser.ExprListContext, preserving the null value
(or returning null if the index is invalid) to determine if the arguments are
valid according to the supplied signature |
public static MappingExpressionParser.ExprValuesContext addArrayExprVarContext(MappingExpressionParser.ExprContext ctx, MappingExpressionParser.ExprValuesContext evc, com.fasterxml.jackson.databind.node.ArrayNode arrayNode)
MappingExpressionParser.ExprValuesContext using the supplied context and
array node contentctx - context to serve as a parent context and provide invoking
stateevc - expression values context to be updatedarrayNode - array values to be added to the expression values contextMappingExpressionParser.ExprValuesContext updated with the supplied context and array
contextpublic static MappingExpressionParser.ExprValuesContext addIndexExprVarContext(MappingExpressionParser.ExprContext ctx, MappingExpressionParser.ExprValuesContext evc, Integer index)
MappingExpressionParser.ExprValuesContext using the context containing the
supplied index valuectx - context to serve as a parent context and provide invoking stateevc - expression values context to be updatedindex - value to be added to the expression values contextMappingExpressionParser.ExprValuesContext updated using the context containing the
supplied index valuepublic static MappingExpressionParser.ExprValuesContext addObjectExprVarContext(MappingExpressionParser.ExprContext ctx, MappingExpressionParser.ExprValuesContext evc, com.fasterxml.jackson.databind.node.ObjectNode object)
MappingExpressionParser.ExprValuesContext using the context containing the
supplied object valuectx - context to serve as a parent context and provide invoking stateevc - expression values context to be updatedobject - value to be added to the expression values contextMappingExpressionParser.ExprValuesContext updated using the context containing the
supplied index valuepublic static MappingExpressionParser.ExprValuesContext addStringExprVarContext(MappingExpressionParser.ExprContext ctx, MappingExpressionParser.ExprValuesContext evc, String string)
MappingExpressionParser.ExprValuesContext using the context containing the
supplied string valuectx - context to serve as the parent of the generated contextevc - expression values contextstring - value to be added to the ExprValuesContextMappingExpressionParser.ExprValuesContext updated using the context containing the
supplied index valuepublic static MappingExpressionParser.ExprValuesContext fillExprVarContext(int fctVarCount, MappingExpressionParser.ExprContext ctx, com.fasterxml.jackson.databind.JsonNode... elements)
MappingExpressionParser.ExprValuesContext containing a parenthesized comma
separated variable list of the supplied elementsfctVarCount - the maximum number of parameters the receiving function will acceptctx - context used to create the MappingExpressionParser.ExprValuesContextelements - the values to be added to the listMappingExpressionParser.ExprValuesContext containing a parenthesized comma separated
variable list of the supplied elementspublic static MappingExpressionParser.ExprValuesContext fillExprVarContext(MappingExpressionParser.ExprContext ctx, String key, com.fasterxml.jackson.databind.JsonNode value)
MappingExpressionParser.ExprValuesContext variables for the function($v,$k)
signature used in each call for pairs of values and keysctx - context to be used to create the new MappingExpressionParser.ExprListContext to
contain the key, value pairkey - key used to relate the supplied value in the ExprValuesContextvalue - content to be added to the ExprValuesContextMappingExpressionParser.ExprValuesContext containing the key and value in its
parenthesized comma separated variable MappingExpressionParser.ExprListContextpublic static MappingExpressionParser.Array_constructorContext getArrayConstructorContext(MappingExpressionParser.ExprContext ctx, com.fasterxml.jackson.databind.node.ArrayNode array)
MappingExpressionParser.Array_constructorContext from the supplied context and
arrayctx - context to serve as parent of generated context.array - ArrayNode whose content is used to create the Array_constructor
contextMappingExpressionParser.Array_constructorContext created from the supplied context
and arraypublic static com.fasterxml.jackson.databind.JsonNode getContextVariable(ExpressionsVisitor exprVisitor)
ExpressionsVisitor
stack, allowing for a null to be returned (in lieu of a NullNode)exprVisitor - the expression visitor whose stack is being usedpublic static com.fasterxml.jackson.databind.JsonNode getContextVariableOrNullNode(ExpressionsVisitor exprVisitor)
ExpressionsVisitor
stackexprVisitor - public static MappingExpressionParser.Object_constructorContext getObjectConstructorContext(MappingExpressionParser.ExprContext ctx, com.fasterxml.jackson.databind.node.ObjectNode object)
MappingExpressionParser.Object_constructorContext from the supplied context and
objectctx - ObjectConstructorContextobject - ObjectNode whose context is soughtMappingExpressionParser.Object_constructorContext created from the supplied context
and objectpublic static com.fasterxml.jackson.databind.JsonNode getValuesListExpression(ExpressionsVisitor exprVisitor, MappingExpressionParser.Function_callContext ctx, int index)
MappingExpressionParser.ExprValuesContext MappingExpressionParser.ExprListContext, preserving the null value
(or returning null if the index is invalid)exprVisitor - used to visit the context's valuesctx - context providing MappingExpressionParser.ExprValuesContext
MappingExpressionParser.ExprListContextindex - non-negative index into the MappingExpressionParser.ExprListContextMappingExpressionParser.ExprValuesContext MappingExpressionParser.ExprListContext, or a
NullNode if none existspublic static void validateArguments(String possibleException, ExpressionsVisitor exprVisitor, MappingExpressionParser.Function_callContext ctx, int index, String signature)
MappingExpressionParser.ExprValuesContext MappingExpressionParser.ExprListContext, preserving the null value
(or returning null if the index is invalid) to determine if the arguments are
valid according to the supplied signatureexprVisitor - used to visit the context's valuesctx - context providing MappingExpressionParser.ExprValuesContext
MappingExpressionParser.ExprListContextindex - non-negative index into the MappingExpressionParser.ExprListContextsignature - the acceptable arguments signatureEvaluateRuntimeException - if the variables do not match the signaturepublic static boolean checkArgument(ExpressionsVisitor exprVisitor, MappingExpressionParser.ExprContext exprCtx, String signature)
exprCtx - argument to be testedsignature - test to be performedpublic static com.fasterxml.jackson.databind.JsonNode getValuesListExpressionOrNullNode(ExpressionsVisitor exprVisitor, MappingExpressionParser.Function_callContext ctx, int index)
exprVisitor - used to visit the context's valuesctx - context providing MappingExpressionParser.ExprValuesContext
MappingExpressionParser.ExprListContextindex - non-negative index into the MappingExpressionParser.ExprListContextMappingExpressionParser.ExprValuesContext MappingExpressionParser.ExprListContext, or a
NullNode if none existspublic static com.fasterxml.jackson.databind.JsonNode processVariablesCallFunction(ExpressionsVisitor exprVisitor, Function function, org.antlr.v4.runtime.tree.TerminalNode varid, MappingExpressionParser.Function_callContext ctx, com.fasterxml.jackson.databind.JsonNode... elements)
MappingExpressionParser.ExprListContext containing the parenthesized comma
separated variable list of JsonNode elements, sets it in the supplied context
(ctx) and then executes the function to return its result.exprVisitor - used to invoke the function after updating its context
variablesfunction - the function to be invokedvarid - the variable to be associated with the elementsctx - the context to be updated and used by the function when
invokedelements - the values to be set in the MappingExpressionParser.ExprValuesContext used
by the function when invokedpublic static com.fasterxml.jackson.databind.JsonNode processFctCallVariables(ExpressionsVisitor exprVisitor, Function function, org.antlr.v4.runtime.tree.TerminalNode varid, MappingExpressionParser.Function_callContext ctx, com.fasterxml.jackson.databind.JsonNode value, String key, com.fasterxml.jackson.databind.node.ObjectNode object)
MappingExpressionParser.ExprListContext containing the parenthesized comma
separated variable list of JsonNode elements, sets it in the supplied context
(ctx) and then executes the function to return its result.exprVisitor - used to invoke the function after updating its context
variablesfunction - the function to be invokedvarid - the variable to be associated with the elementsctx - the context to be updated and used by the function when
invokedvalue - the value to be set in the MappingExpressionParser.ExprValuesContext used
by the function when invokedkey - the key to be set in the MappingExpressionParser.ExprValuesContext used by
the function when invokedobject - the object to be set in the MappingExpressionParser.ExprValuesContext used
by the function when invokedpublic static boolean useContextVariable(Function fct, MappingExpressionParser.Function_callContext ctx, String signature)
fct - the function checking whether to use the context variablectx - the context used to invoke the functionsignature - the function signature for the function being tested. If
this contains a hyphen, then it can use the contextCopyright © 2020. All rights reserved.