@Test void evaluateMap() { Map<String, Object> input = Collections.singletonMap("key", "value"); Map<String, Object> evaluated = new ExpressionTransform(parserContext, parser, Function.identity()) .transformMap( input, new StandardEvaluationContext(), new ExpressionEvaluationSummary()); assertThat(evaluated).isEqualTo(input); }
public Map<String, Object> transformMap( Map<String, Object> source, EvaluationContext evaluationContext, ExpressionEvaluationSummary summary) { Map<String, Object> result = new HashMap<>(); Map<String, Object> copy = Collections.unmodifiableMap(source); source.forEach( (key, value) -> { if (value instanceof Map) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformMap((Map) value, evaluationContext, summary)); } else if (value instanceof List) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformList((List) value, evaluationContext, summary, copy)); } else { result.put( transform(key, evaluationContext, summary, copy).toString(), transform(value, evaluationContext, summary, copy)); } }); return result; }
ExpressionTransform { public Map<String, Object> transformMap( Map<String, Object> source, EvaluationContext evaluationContext, ExpressionEvaluationSummary summary) { Map<String, Object> result = new HashMap<>(); Map<String, Object> copy = Collections.unmodifiableMap(source); source.forEach( (key, value) -> { if (value instanceof Map) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformMap((Map) value, evaluationContext, summary)); } else if (value instanceof List) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformList((List) value, evaluationContext, summary, copy)); } else { result.put( transform(key, evaluationContext, summary, copy).toString(), transform(value, evaluationContext, summary, copy)); } }); return result; } }
ExpressionTransform { public Map<String, Object> transformMap( Map<String, Object> source, EvaluationContext evaluationContext, ExpressionEvaluationSummary summary) { Map<String, Object> result = new HashMap<>(); Map<String, Object> copy = Collections.unmodifiableMap(source); source.forEach( (key, value) -> { if (value instanceof Map) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformMap((Map) value, evaluationContext, summary)); } else if (value instanceof List) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformList((List) value, evaluationContext, summary, copy)); } else { result.put( transform(key, evaluationContext, summary, copy).toString(), transform(value, evaluationContext, summary, copy)); } }); return result; } ExpressionTransform(
      ParserContext parserContext,
      ExpressionParser parser,
      Function<String, String> stringExpressionPreprocessor,
      Class<?>... typesToStringify); }
ExpressionTransform { public Map<String, Object> transformMap( Map<String, Object> source, EvaluationContext evaluationContext, ExpressionEvaluationSummary summary) { Map<String, Object> result = new HashMap<>(); Map<String, Object> copy = Collections.unmodifiableMap(source); source.forEach( (key, value) -> { if (value instanceof Map) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformMap((Map) value, evaluationContext, summary)); } else if (value instanceof List) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformList((List) value, evaluationContext, summary, copy)); } else { result.put( transform(key, evaluationContext, summary, copy).toString(), transform(value, evaluationContext, summary, copy)); } }); return result; } ExpressionTransform(
      ParserContext parserContext,
      ExpressionParser parser,
      Function<String, String> stringExpressionPreprocessor,
      Class<?>... typesToStringify); static String escapeSimpleExpression(String expression); Map<String, Object> transformMap(
      Map<String, Object> source,
      EvaluationContext evaluationContext,
      ExpressionEvaluationSummary summary); List transformList(
      List source,
      EvaluationContext evaluationContext,
      ExpressionEvaluationSummary summary,
      Map<String, Object> additionalContext); String transformString(
      String source, EvaluationContext evaluationContext, ExpressionEvaluationSummary summary); }
ExpressionTransform { public Map<String, Object> transformMap( Map<String, Object> source, EvaluationContext evaluationContext, ExpressionEvaluationSummary summary) { Map<String, Object> result = new HashMap<>(); Map<String, Object> copy = Collections.unmodifiableMap(source); source.forEach( (key, value) -> { if (value instanceof Map) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformMap((Map) value, evaluationContext, summary)); } else if (value instanceof List) { result.put( transform(key, evaluationContext, summary, copy).toString(), transformList((List) value, evaluationContext, summary, copy)); } else { result.put( transform(key, evaluationContext, summary, copy).toString(), transform(value, evaluationContext, summary, copy)); } }); return result; } ExpressionTransform(
      ParserContext parserContext,
      ExpressionParser parser,
      Function<String, String> stringExpressionPreprocessor,
      Class<?>... typesToStringify); static String escapeSimpleExpression(String expression); Map<String, Object> transformMap(
      Map<String, Object> source,
      EvaluationContext evaluationContext,
      ExpressionEvaluationSummary summary); List transformList(
      List source,
      EvaluationContext evaluationContext,
      ExpressionEvaluationSummary summary,
      Map<String, Object> additionalContext); String transformString(
      String source, EvaluationContext evaluationContext, ExpressionEvaluationSummary summary);  }