|
2 | 2 |
|
3 | 3 | import java.io.File;
|
4 | 4 | import java.util.Map;
|
5 |
| -import java.util.function.Function; |
| 5 | +import java.util.function.BiFunction; |
6 | 6 | import java.util.function.Supplier;
|
7 | 7 |
|
8 | 8 | import org.jooq.lambda.Seq;
|
@@ -45,16 +45,16 @@ public static Map<String, Object> asMap(Config config) {
|
45 | 45 | .toMap(e -> e.getKey(), e -> e.getValue().unwrapped());
|
46 | 46 | }
|
47 | 47 |
|
48 |
| - public static <T> T getOrDefault(Config config, String path, Function<Config, T> extractor, T defaultValue) { |
| 48 | + public static <T> T getOrDefault(Config config, String path, BiFunction<Config, String, T> extractor, T defaultValue) { |
49 | 49 | if (config.hasPath(path)) {
|
50 |
| - return extractor.apply(config); |
| 50 | + return extractor.apply(config, path); |
51 | 51 | }
|
52 | 52 | return defaultValue;
|
53 | 53 | }
|
54 | 54 |
|
55 |
| - public static <T> T getOrDefault(Config config, String path, Function<Config, T> extractor, Supplier<T> defaultSupplier) { |
| 55 | + public static <T> T getOrDefault(Config config, String path, BiFunction<Config, String, T> extractor, Supplier<T> defaultSupplier) { |
56 | 56 | if (config.hasPath(path)) {
|
57 |
| - return extractor.apply(config); |
| 57 | + return extractor.apply(config, path); |
58 | 58 | }
|
59 | 59 | return defaultSupplier.get();
|
60 | 60 | }
|
|
0 commit comments