Package com.schibsted.spt.data.jslt.impl
Class ExpressionImpl
- java.lang.Object
-
- com.schibsted.spt.data.jslt.impl.ExpressionImpl
-
- All Implemented Interfaces:
Expression
public class ExpressionImpl extends java.lang.Object implements Expression
Wrapper class that translates an external Expression to an ExpressionNode.
-
-
Field Summary
Fields Modifier and Type Field Description private ExpressionNode
actual
private JstlFile[]
fileModules
private java.util.Map<java.lang.String,Function>
functions
private LetExpression[]
lets
private java.util.Map<java.lang.String,java.lang.Integer>
parameterSlots
private int
stackFrameSize
-
Constructor Summary
Constructors Constructor Description ExpressionImpl(LetExpression[] lets, java.util.Map<java.lang.String,Function> functions, ExpressionNode actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.JsonNode
apply(com.fasterxml.jackson.databind.JsonNode input)
Evaluate the expression on the given JSON input.com.fasterxml.jackson.databind.JsonNode
apply(Scope scope, com.fasterxml.jackson.databind.JsonNode input)
com.fasterxml.jackson.databind.JsonNode
apply(java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> variables, com.fasterxml.jackson.databind.JsonNode input)
Evaluate the expression on the given JSON input, with the given predefined variables set.void
dump()
void
evaluateLetsOnly(Scope scope, com.fasterxml.jackson.databind.JsonNode input)
This is used to initialize global variables when the ExpressionImpl is a module.java.util.List<ExpressionNode>
getChildren()
Function
getFunction(java.lang.String name)
int
getStackFrameSize()
boolean
hasBody()
void
optimize()
void
prepare(PreparationContext ctx)
void
setGlobalModules(java.util.List<JstlFile> fileModules)
java.lang.String
toString()
-
-
-
Field Detail
-
lets
private LetExpression[] lets
-
functions
private java.util.Map<java.lang.String,Function> functions
-
actual
private ExpressionNode actual
-
stackFrameSize
private int stackFrameSize
-
fileModules
private JstlFile[] fileModules
-
parameterSlots
private java.util.Map<java.lang.String,java.lang.Integer> parameterSlots
-
-
Constructor Detail
-
ExpressionImpl
public ExpressionImpl(LetExpression[] lets, java.util.Map<java.lang.String,Function> functions, ExpressionNode actual)
-
-
Method Detail
-
getFunction
public Function getFunction(java.lang.String name)
-
hasBody
public boolean hasBody()
-
apply
public com.fasterxml.jackson.databind.JsonNode apply(java.util.Map<java.lang.String,com.fasterxml.jackson.databind.JsonNode> variables, com.fasterxml.jackson.databind.JsonNode input)
Description copied from interface:Expression
Evaluate the expression on the given JSON input, with the given predefined variables set.- Specified by:
apply
in interfaceExpression
- Parameters:
variables
- Variable bindings visible inside the expression.input
- The JSON input to evaluate the expression on.
-
apply
public com.fasterxml.jackson.databind.JsonNode apply(com.fasterxml.jackson.databind.JsonNode input)
Description copied from interface:Expression
Evaluate the expression on the given JSON input.- Specified by:
apply
in interfaceExpression
- Parameters:
input
- The JSON input to evaluate the expression on.
-
apply
public com.fasterxml.jackson.databind.JsonNode apply(Scope scope, com.fasterxml.jackson.databind.JsonNode input)
-
dump
public void dump()
-
prepare
public void prepare(PreparationContext ctx)
-
evaluateLetsOnly
public void evaluateLetsOnly(Scope scope, com.fasterxml.jackson.databind.JsonNode input)
This is used to initialize global variables when the ExpressionImpl is a module. Called once during compilation. The values are then remembered forever.
-
optimize
public void optimize()
-
getChildren
public java.util.List<ExpressionNode> getChildren()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getStackFrameSize
public int getStackFrameSize()
-
setGlobalModules
public void setGlobalModules(java.util.List<JstlFile> fileModules)
-
-