Package com.schibsted.spt.data.jslt.impl
Class FunctionDeclaration
- java.lang.Object
-
- com.schibsted.spt.data.jslt.impl.AbstractNode
-
- com.schibsted.spt.data.jslt.impl.FunctionDeclaration
-
- All Implemented Interfaces:
Callable
,Function
,ExpressionNode
public class FunctionDeclaration extends AbstractNode implements Function, ExpressionNode
-
-
Field Summary
Fields Modifier and Type Field Description private ExpressionNode
body
private LetExpression[]
lets
private java.lang.String
name
private java.lang.String[]
parameters
private int[]
parameterSlots
private int
stackFrameSize
-
Fields inherited from class com.schibsted.spt.data.jslt.impl.AbstractNode
location
-
-
Constructor Summary
Constructors Constructor Description FunctionDeclaration(java.lang.String name, java.lang.String[] parameters, LetExpression[] lets, ExpressionNode body)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.JsonNode
apply(Scope scope, com.fasterxml.jackson.databind.JsonNode context)
com.fasterxml.jackson.databind.JsonNode
call(com.fasterxml.jackson.databind.JsonNode input, com.fasterxml.jackson.databind.JsonNode[] arguments)
Perform the function on the given JSON input with the given arguments.com.fasterxml.jackson.databind.JsonNode
call(Scope scope, com.fasterxml.jackson.databind.JsonNode input, com.fasterxml.jackson.databind.JsonNode[] arguments)
void
computeMatchContexts(DotExpression parent)
int
getMaxArguments()
The maximum number of arguments allowed.int
getMinArguments()
The minimum number of arguments allowed.java.lang.String
getName()
The name of the function.ExpressionNode
optimize()
void
prepare(PreparationContext ctx)
-
Methods inherited from class com.schibsted.spt.data.jslt.impl.AbstractNode
dump, getChildren, getLocation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.schibsted.spt.data.jslt.impl.ExpressionNode
dump, getChildren
-
-
-
-
Field Detail
-
name
private java.lang.String name
-
parameters
private java.lang.String[] parameters
-
parameterSlots
private int[] parameterSlots
-
lets
private LetExpression[] lets
-
body
private ExpressionNode body
-
stackFrameSize
private int stackFrameSize
-
-
Constructor Detail
-
FunctionDeclaration
public FunctionDeclaration(java.lang.String name, java.lang.String[] parameters, LetExpression[] lets, ExpressionNode body)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Function
The name of the function.
-
getMinArguments
public int getMinArguments()
Description copied from interface:Function
The minimum number of arguments allowed.- Specified by:
getMinArguments
in interfaceCallable
- Specified by:
getMinArguments
in interfaceFunction
-
getMaxArguments
public int getMaxArguments()
Description copied from interface:Function
The maximum number of arguments allowed.- Specified by:
getMaxArguments
in interfaceCallable
- Specified by:
getMaxArguments
in interfaceFunction
-
call
public com.fasterxml.jackson.databind.JsonNode call(com.fasterxml.jackson.databind.JsonNode input, com.fasterxml.jackson.databind.JsonNode[] arguments)
Description copied from interface:Function
Perform the function on the given JSON input with the given arguments.
-
call
public com.fasterxml.jackson.databind.JsonNode call(Scope scope, com.fasterxml.jackson.databind.JsonNode input, com.fasterxml.jackson.databind.JsonNode[] arguments)
-
optimize
public ExpressionNode optimize()
- Specified by:
optimize
in interfaceExpressionNode
- Overrides:
optimize
in classAbstractNode
-
apply
public com.fasterxml.jackson.databind.JsonNode apply(Scope scope, com.fasterxml.jackson.databind.JsonNode context)
- Specified by:
apply
in interfaceExpressionNode
-
computeMatchContexts
public void computeMatchContexts(DotExpression parent)
- Specified by:
computeMatchContexts
in interfaceExpressionNode
- Overrides:
computeMatchContexts
in classAbstractNode
-
prepare
public void prepare(PreparationContext ctx)
- Specified by:
prepare
in interfaceExpressionNode
- Overrides:
prepare
in classAbstractNode
-
-