| 1 | package com.github.dakusui.actionunit.core.context.multiparams; | |
| 2 | ||
| 3 | import com.github.dakusui.actionunit.actions.ContextVariable; | |
| 4 | import com.github.dakusui.actionunit.core.Context; | |
| 5 | import com.github.dakusui.actionunit.core.context.ContextFunction; | |
| 6 | ||
| 7 | import java.util.function.BiFunction; | |
| 8 | import java.util.function.Function; | |
| 9 | ||
| 10 | import static com.github.dakusui.actionunit.actions.cmd.PlaceHolderFormatter.DEFAULT_PLACE_HOLDER_FORMATTER; | |
| 11 | import static com.github.dakusui.actionunit.core.context.ContextFunctions.describeFunctionalObject; | |
| 12 | import static java.util.Objects.requireNonNull; | |
| 13 | ||
| 14 | public class MultiParamsContextFunctionBuilder<R> { | |
| 15 | private final ContextVariable[] variables; | |
| 16 | private final BiFunction<Function<?, ?>, ContextVariable[], String> descriptionFormatter; | |
| 17 | ||
| 18 | public MultiParamsContextFunctionBuilder(ContextVariable... variables) { | |
| 19 | this( | |
| 20 |
1
1. lambda$new$0 : replaced return value with "" for com/github/dakusui/actionunit/core/context/multiparams/MultiParamsContextFunctionBuilder::lambda$new$0 → KILLED |
(f, v) -> describeFunctionalObject(f, DEFAULT_PLACE_HOLDER_FORMATTER.apply(v), v), |
| 21 | variables | |
| 22 | ); | |
| 23 | } | |
| 24 | ||
| 25 | private MultiParamsContextFunctionBuilder( | |
| 26 | BiFunction<Function<?, ?>, ContextVariable[], String> descriptionFormatter, ContextVariable... variables) { | |
| 27 | this.descriptionFormatter = requireNonNull(descriptionFormatter); | |
| 28 | this.variables = requireNonNull(variables); | |
| 29 | } | |
| 30 | ||
| 31 | public Function<Context, R> toContextFunction(Function<Params, R> function) { | |
| 32 | requireNonNull(function); | |
| 33 |
1
1. toContextFunction : replaced return value with null for com/github/dakusui/actionunit/core/context/multiparams/MultiParamsContextFunctionBuilder::toContextFunction → KILLED |
return new ContextFunction.Impl<>( |
| 34 |
1
1. lambda$toContextFunction$1 : replaced return value with "" for com/github/dakusui/actionunit/core/context/multiparams/MultiParamsContextFunctionBuilder::lambda$toContextFunction$1 → KILLED |
() -> descriptionFormatter.apply(function, variables), |
| 35 |
1
1. lambda$toContextFunction$2 : replaced return value with null for com/github/dakusui/actionunit/core/context/multiparams/MultiParamsContextFunctionBuilder::lambda$toContextFunction$2 → KILLED |
(Context c) -> function.apply(Params.create(c, variables))); |
| 36 | } | |
| 37 | } | |
Mutations | ||
| 20 |
1.1 |
|
| 33 |
1.1 |
|
| 34 |
1.1 |
|
| 35 |
1.1 |