@Test public void concat() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", listValue(stringValue("a"), stringValue("b"), numericValue(12)))); assertEquals("a---b---12", actual.getValue()); }
@Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ListExpressionResult value = (ListExpressionResult)valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return NullExpressionResult.INSTANCE; String chars = charsExpression.apply(context, input).toString(); String concatted = value.getValue().stream().map(String::valueOf).collect(Collectors.joining(chars)); return new StringExpressionResult(concatted); }
ConcatExpression implements Expression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ListExpressionResult value = (ListExpressionResult)valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return NullExpressionResult.INSTANCE; String chars = charsExpression.apply(context, input).toString(); String concatted = value.getValue().stream().map(String::valueOf).collect(Collectors.joining(chars)); return new StringExpressionResult(concatted); } }
ConcatExpression implements Expression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ListExpressionResult value = (ListExpressionResult)valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return NullExpressionResult.INSTANCE; String chars = charsExpression.apply(context, input).toString(); String concatted = value.getValue().stream().map(String::valueOf).collect(Collectors.joining(chars)); return new StringExpressionResult(concatted); } ConcatExpression(String alias, Expression[] expressions); }
ConcatExpression implements Expression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ListExpressionResult value = (ListExpressionResult)valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return NullExpressionResult.INSTANCE; String chars = charsExpression.apply(context, input).toString(); String concatted = value.getValue().stream().map(String::valueOf).collect(Collectors.joining(chars)); return new StringExpressionResult(concatted); } ConcatExpression(String alias, Expression[] expressions); @Override ExpressionResult apply(ExpressionContext context, ExpressionResult input); @Override String alias(); }
ConcatExpression implements Expression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ListExpressionResult value = (ListExpressionResult)valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return NullExpressionResult.INSTANCE; String chars = charsExpression.apply(context, input).toString(); String concatted = value.getValue().stream().map(String::valueOf).collect(Collectors.joining(chars)); return new StringExpressionResult(concatted); } ConcatExpression(String alias, Expression[] expressions); @Override ExpressionResult apply(ExpressionContext context, ExpressionResult input); @Override String alias();  }