Class AbstractExpressionEvaluator
- java.lang.Object
-
- org.drools.scenariosimulation.backend.expression.AbstractExpressionEvaluator
-
- All Implemented Interfaces:
ExpressionEvaluator
- Direct Known Subclasses:
BaseExpressionEvaluator,DMNFeelExpressionEvaluator
public abstract class AbstractExpressionEvaluator extends Object implements ExpressionEvaluator
-
-
Constructor Summary
Constructors Constructor Description AbstractExpressionEvaluator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ObjectconvertResult(String rawString, String className, List<String> genericClasses)protected List<Object>createAndFillList(com.fasterxml.jackson.databind.node.ArrayNode json, List<Object> toReturn, String className, List<String> genericClasses)protected ObjectcreateAndFillObject(com.fasterxml.jackson.databind.node.ObjectNode json, Object toReturn, String className, List<String> genericClasses)protected abstract ObjectcreateObject(String className, List<String> genericClasses)ObjectevaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses)ExpressionEvaluatorResultevaluateUnaryExpression(String rawExpression, Object resultValue, Class<?> resultClass)protected abstract ObjectextractFieldValue(Object result, String fieldName)protected abstract Map.Entry<String,List<String>>getFieldClassNameAndGenerics(Object element, String fieldName, String className, List<String> genericClasses)Return a pair with field className as key and list of generics as valueprotected StringgetSimpleTypeNodeTextValue(com.fasterxml.jackson.databind.JsonNode jsonNode)Return text value of a simple type nodeprotected abstract ObjectinternalLiteralEvaluation(String raw, String className)protected abstract booleaninternalUnaryEvaluation(String rawExpression, Object resultValue, Class<?> resultClass, boolean skipEmptyString)protected booleanisEmptyText(com.fasterxml.jackson.databind.JsonNode jsonNode)Verify if given json node text is emptyprotected booleanisListEmpty(com.fasterxml.jackson.databind.node.ArrayNode json)Verify if all elements of given json array are emptyprotected booleanisNodeEmpty(com.fasterxml.jackson.databind.JsonNode json)Verify if given json node has all final values as empty stringsprotected booleanisObjectEmpty(com.fasterxml.jackson.databind.node.ObjectNode json)Verify if all fields of given json object are emptyprotected booleanisSimpleTypeNode(com.fasterxml.jackson.databind.JsonNode jsonNode)A node represent a simple type if it is an object with only one field named "value"protected booleanisStructuredInput(String className)Check if className represents a structured inputprotected booleanisStructuredResult(Class<?> resultClass)Check if resultClass represents a structured resultprotected abstract voidsetField(Object toReturn, String fieldName, Object fieldValue)protected ExpressionEvaluatorResultverifyList(com.fasterxml.jackson.databind.node.ArrayNode json, List<Object> resultRaw)protected ExpressionEvaluatorResultverifyObject(com.fasterxml.jackson.databind.node.ObjectNode json, Object resultRaw)protected ExpressionEvaluatorResultverifyResult(String rawExpression, Object resultRaw, Class<?> resultClass)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drools.scenariosimulation.backend.expression.ExpressionEvaluator
fromObjectToExpression
-
-
-
-
Method Detail
-
evaluateLiteralExpression
public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses)
- Specified by:
evaluateLiteralExpressionin interfaceExpressionEvaluator
-
evaluateUnaryExpression
public ExpressionEvaluatorResult evaluateUnaryExpression(String rawExpression, Object resultValue, Class<?> resultClass)
- Specified by:
evaluateUnaryExpressionin interfaceExpressionEvaluator
-
isStructuredResult
protected boolean isStructuredResult(Class<?> resultClass)
Check if resultClass represents a structured result- Parameters:
resultClass-- Returns:
-
isStructuredInput
protected boolean isStructuredInput(String className)
Check if className represents a structured input- Parameters:
className-- Returns:
-
convertResult
protected Object convertResult(String rawString, String className, List<String> genericClasses)
-
createAndFillList
protected List<Object> createAndFillList(com.fasterxml.jackson.databind.node.ArrayNode json, List<Object> toReturn, String className, List<String> genericClasses)
-
createAndFillObject
protected Object createAndFillObject(com.fasterxml.jackson.databind.node.ObjectNode json, Object toReturn, String className, List<String> genericClasses)
-
verifyResult
protected ExpressionEvaluatorResult verifyResult(String rawExpression, Object resultRaw, Class<?> resultClass)
-
verifyList
protected ExpressionEvaluatorResult verifyList(com.fasterxml.jackson.databind.node.ArrayNode json, List<Object> resultRaw)
-
verifyObject
protected ExpressionEvaluatorResult verifyObject(com.fasterxml.jackson.databind.node.ObjectNode json, Object resultRaw)
-
isNodeEmpty
protected boolean isNodeEmpty(com.fasterxml.jackson.databind.JsonNode json)
Verify if given json node has all final values as empty strings- Parameters:
json-- Returns:
-
isListEmpty
protected boolean isListEmpty(com.fasterxml.jackson.databind.node.ArrayNode json)
Verify if all elements of given json array are empty- Parameters:
json-- Returns:
-
isObjectEmpty
protected boolean isObjectEmpty(com.fasterxml.jackson.databind.node.ObjectNode json)
Verify if all fields of given json object are empty- Parameters:
json-- Returns:
-
isEmptyText
protected boolean isEmptyText(com.fasterxml.jackson.databind.JsonNode jsonNode)
Verify if given json node text is empty- Parameters:
jsonNode-- Returns:
-
isSimpleTypeNode
protected boolean isSimpleTypeNode(com.fasterxml.jackson.databind.JsonNode jsonNode)
A node represent a simple type if it is an object with only one field named "value"- Parameters:
jsonNode-- Returns:
-
getSimpleTypeNodeTextValue
protected String getSimpleTypeNodeTextValue(com.fasterxml.jackson.databind.JsonNode jsonNode)
Return text value of a simple type node- Parameters:
jsonNode-- Returns:
-
internalUnaryEvaluation
protected abstract boolean internalUnaryEvaluation(String rawExpression, Object resultValue, Class<?> resultClass, boolean skipEmptyString)
-
internalLiteralEvaluation
protected abstract Object internalLiteralEvaluation(String raw, String className)
-
getFieldClassNameAndGenerics
protected abstract Map.Entry<String,List<String>> getFieldClassNameAndGenerics(Object element, String fieldName, String className, List<String> genericClasses)
Return a pair with field className as key and list of generics as value- Parameters:
element- : instance to be populatedfieldName- : field to analyzeclassName- : canonical class name of instancegenericClasses- : list of generics related to this field- Returns:
-
-