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 ExpressionNodeactualprivate JstlFile[]fileModulesprivate java.util.Map<java.lang.String,Function>functionsprivate LetExpression[]letsprivate java.util.Map<java.lang.String,java.lang.Integer>parameterSlotsprivate intstackFrameSize
-
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.JsonNodeapply(com.fasterxml.jackson.databind.JsonNode input)Evaluate the expression on the given JSON input.com.fasterxml.jackson.databind.JsonNodeapply(Scope scope, com.fasterxml.jackson.databind.JsonNode input)com.fasterxml.jackson.databind.JsonNodeapply(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.voiddump()voidevaluateLetsOnly(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()FunctiongetFunction(java.lang.String name)intgetStackFrameSize()booleanhasBody()voidoptimize()voidprepare(PreparationContext ctx)voidsetGlobalModules(java.util.List<JstlFile> fileModules)java.lang.StringtoString()
-
-
-
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:ExpressionEvaluate the expression on the given JSON input, with the given predefined variables set.- Specified by:
applyin 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:ExpressionEvaluate the expression on the given JSON input.- Specified by:
applyin 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:
toStringin classjava.lang.Object
-
getStackFrameSize
public int getStackFrameSize()
-
setGlobalModules
public void setGlobalModules(java.util.List<JstlFile> fileModules)
-
-