diff --git a/scenario-compiler/src/main/scala/pl/touk/nussknacker/engine/definition/component/parameter/defaults/TypeRelatedParameterValueDeterminer.scala b/scenario-compiler/src/main/scala/pl/touk/nussknacker/engine/definition/component/parameter/defaults/TypeRelatedParameterValueDeterminer.scala index b5659217553..712fc93181a 100644 --- a/scenario-compiler/src/main/scala/pl/touk/nussknacker/engine/definition/component/parameter/defaults/TypeRelatedParameterValueDeterminer.scala +++ b/scenario-compiler/src/main/scala/pl/touk/nussknacker/engine/definition/component/parameter/defaults/TypeRelatedParameterValueDeterminer.scala @@ -1,7 +1,9 @@ package pl.touk.nussknacker.engine.definition.component.parameter.defaults +import pl.touk.nussknacker.engine.api.TemplateEvaluationResult import pl.touk.nussknacker.engine.api.definition.ParameterEditor import pl.touk.nussknacker.engine.api.typed.typing.SingleTypingResult +import pl.touk.nussknacker.engine.api.util.ReflectUtils import pl.touk.nussknacker.engine.graph.expression.Expression import pl.touk.nussknacker.engine.graph.expression.Expression.Language @@ -19,19 +21,23 @@ protected object TypeRelatedParameterValueDeterminer extends ParameterDefaultVal private[defaults] def determineTypeRelatedDefaultParamValue( editor: Option[ParameterEditor], - className: Class[_] + klass: Class[_] ): Option[Expression] = { + def isTemplateExaluationResult(className: String) = { + className == TemplateEvaluationResult.getClass.getName.stripSuffix("$") + } // TODO: use classes instead of class names - Option(className).map(_.getName).collect { + Option(klass).map(_.getName).collect { case "long" | "short" | "int" | "java.lang.Number" | "java.lang.Long" | "java.lang.Short" | "java.lang.Integer" | "java.math.BigInteger" => Expression.spel("0") case "float" | "double" | "java.math.BigDecimal" | "java.lang.Float" | "java.lang.Double" => Expression.spel("0.0") case "boolean" | "java.lang.Boolean" => Expression.spel("true") - case "java.lang.String" => defaultStringExpression(editor) - case "java.util.List" => Expression.spel("{}") - case "java.util.Map" => Expression.spel("{:}") + case className if isTemplateExaluationResult(className) | className == "java.lang.String" => + defaultStringExpression(editor) + case "java.util.List" => Expression.spel("{}") + case "java.util.Map" => Expression.spel("{:}") } }