@Test public void convertList() { ArrayNode jsonNodes = new ArrayNode(factory); ObjectNode objectNode = new ObjectNode(factory); objectNode.put(VALUE, "data"); jsonNodes.add(objectNode); List<Object> objects = expressionEvaluatorLocal.createAndFillList(jsonNodes, new ArrayList<>(), List.class.getCanonicalName(), Collections.singletonList(String.class.getCanonicalName())); assertEquals("data", objects.get(0)); }
protected List<Object> createAndFillList(ArrayNode json, List<Object> toReturn, String className, List<String> genericClasses) { for (JsonNode node : json) { if (isSimpleTypeNode(node)) { String generic = genericClasses.get(genericClasses.size() - 1); Object value = internalLiteralEvaluation(getSimpleTypeNodeTextValue(node), generic); toReturn.add(value); } else { String genericClassName = ScenarioSimulationSharedUtils.isMap(className) ? className : genericClasses.get(genericClasses.size() - 1); Object listElement = createObject(genericClassName, genericClasses); Object returnedObject = createAndFillObject((ObjectNode) node, listElement, genericClassName, genericClasses); toReturn.add(returnedObject); } } return toReturn; }
AbstractExpressionEvaluator implements ExpressionEvaluator { protected List<Object> createAndFillList(ArrayNode json, List<Object> toReturn, String className, List<String> genericClasses) { for (JsonNode node : json) { if (isSimpleTypeNode(node)) { String generic = genericClasses.get(genericClasses.size() - 1); Object value = internalLiteralEvaluation(getSimpleTypeNodeTextValue(node), generic); toReturn.add(value); } else { String genericClassName = ScenarioSimulationSharedUtils.isMap(className) ? className : genericClasses.get(genericClasses.size() - 1); Object listElement = createObject(genericClassName, genericClasses); Object returnedObject = createAndFillObject((ObjectNode) node, listElement, genericClassName, genericClasses); toReturn.add(returnedObject); } } return toReturn; } }
AbstractExpressionEvaluator implements ExpressionEvaluator { protected List<Object> createAndFillList(ArrayNode json, List<Object> toReturn, String className, List<String> genericClasses) { for (JsonNode node : json) { if (isSimpleTypeNode(node)) { String generic = genericClasses.get(genericClasses.size() - 1); Object value = internalLiteralEvaluation(getSimpleTypeNodeTextValue(node), generic); toReturn.add(value); } else { String genericClassName = ScenarioSimulationSharedUtils.isMap(className) ? className : genericClasses.get(genericClasses.size() - 1); Object listElement = createObject(genericClassName, genericClasses); Object returnedObject = createAndFillObject((ObjectNode) node, listElement, genericClassName, genericClasses); toReturn.add(returnedObject); } } return toReturn; }  }
AbstractExpressionEvaluator implements ExpressionEvaluator { protected List<Object> createAndFillList(ArrayNode json, List<Object> toReturn, String className, List<String> genericClasses) { for (JsonNode node : json) { if (isSimpleTypeNode(node)) { String generic = genericClasses.get(genericClasses.size() - 1); Object value = internalLiteralEvaluation(getSimpleTypeNodeTextValue(node), generic); toReturn.add(value); } else { String genericClassName = ScenarioSimulationSharedUtils.isMap(className) ? className : genericClasses.get(genericClasses.size() - 1); Object listElement = createObject(genericClassName, genericClasses); Object returnedObject = createAndFillObject((ObjectNode) node, listElement, genericClassName, genericClasses); toReturn.add(returnedObject); } } return toReturn; }  @Override Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses); @Override boolean evaluateUnaryExpression(String rawExpression, Object resultValue, Class<?> resultClass); }
AbstractExpressionEvaluator implements ExpressionEvaluator { protected List<Object> createAndFillList(ArrayNode json, List<Object> toReturn, String className, List<String> genericClasses) { for (JsonNode node : json) { if (isSimpleTypeNode(node)) { String generic = genericClasses.get(genericClasses.size() - 1); Object value = internalLiteralEvaluation(getSimpleTypeNodeTextValue(node), generic); toReturn.add(value); } else { String genericClassName = ScenarioSimulationSharedUtils.isMap(className) ? className : genericClasses.get(genericClasses.size() - 1); Object listElement = createObject(genericClassName, genericClasses); Object returnedObject = createAndFillObject((ObjectNode) node, listElement, genericClassName, genericClasses); toReturn.add(returnedObject); } } return toReturn; }  @Override Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses); @Override boolean evaluateUnaryExpression(String rawExpression, Object resultValue, Class<?> resultClass);  }