From a42a25547e975f378bf0208d7205221d21ccc8ed Mon Sep 17 00:00:00 2001 From: Otavio Santana Date: Tue, 8 Nov 2022 13:03:40 +0000 Subject: [PATCH] Update settings API Signed-off-by: Otavio Santana --- .../src/main/java/jakarta/nosql/Settings.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/api/communication/communication-core/src/main/java/jakarta/nosql/Settings.java b/api/communication/communication-core/src/main/java/jakarta/nosql/Settings.java index 445ec32e6..89e805092 100644 --- a/api/communication/communication-core/src/main/java/jakarta/nosql/Settings.java +++ b/api/communication/communication-core/src/main/java/jakarta/nosql/Settings.java @@ -219,6 +219,15 @@ public interface Settings { */ void computeIfPresent(String key, BiConsumer action); + /** + * If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value. + * + * @param supplier the key + * @param action the action + * @throws NullPointerException when there is null parameter + */ + void computeIfPresent(Supplier supplier, BiConsumer action); + /** * If the specified key is not already associated with a value (or is mapped to null), * attempts to compute its value using the given mapping function and enters it into this map unless null. @@ -229,6 +238,16 @@ public interface Settings { */ void computeIfAbsent(String key, Function action); + /** + * If the specified key is not already associated with a value (or is mapped to null), + * attempts to compute its value using the given mapping function and enters it into this map unless null. + * + * @param supplier the supplier + * @param action the action + * @throws NullPointerException when there is null parameter + */ + void computeIfAbsent(Supplier supplier, Function action); + /** * Creates a {@link SettingsBuilder} *