|
20 | 20 | */
|
21 | 21 | package eu.openanalytics.containerproxy.spec.expression;
|
22 | 22 |
|
23 |
| -import eu.openanalytics.containerproxy.ContainerProxyException; |
24 | 23 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
25 | 24 | import org.springframework.context.ApplicationContext;
|
26 | 25 | import org.springframework.context.ConfigurableApplicationContext;
|
|
34 | 33 | import org.springframework.expression.Expression;
|
35 | 34 | import org.springframework.expression.ExpressionException;
|
36 | 35 | import org.springframework.expression.ExpressionParser;
|
37 |
| -import org.springframework.expression.ParseException; |
38 | 36 | import org.springframework.expression.ParserContext;
|
39 |
| -import org.springframework.expression.spel.SpelEvaluationException; |
40 | 37 | import org.springframework.expression.spel.standard.SpelExpressionParser;
|
41 | 38 | import org.springframework.expression.spel.support.StandardEvaluationContext;
|
42 | 39 | import org.springframework.expression.spel.support.StandardTypeConverter;
|
|
48 | 45 | import java.util.Map;
|
49 | 46 | import java.util.concurrent.ConcurrentHashMap;
|
50 | 47 | import java.util.stream.Collectors;
|
| 48 | +import java.util.stream.Stream; |
51 | 49 |
|
52 | 50 | /**
|
53 | 51 | * Note: inspired by org.springframework.context.expression.StandardBeanExpressionResolver
|
@@ -136,11 +134,14 @@ public List<String> evaluateToList(List<String> expressions, SpecExpressionConte
|
136 | 134 | if (expressions == null) return null;
|
137 | 135 | return expressions.stream()
|
138 | 136 | .flatMap((el) -> {
|
139 |
| - List<String> result = evaluate(el, context, List.class); |
| 137 | + Object result = evaluate(el, context, Object.class); |
140 | 138 | if (result == null) {
|
141 | 139 | result = new ArrayList<>();
|
142 | 140 | }
|
143 |
| - return result.stream(); |
| 141 | + if (result instanceof List) { |
| 142 | + return ((List<Object>) result).stream().map(Object::toString); |
| 143 | + } |
| 144 | + return Stream.of(result.toString()); |
144 | 145 | })
|
145 | 146 | .collect(Collectors.toList());
|
146 | 147 | }
|
|
0 commit comments