From 8d9af32a7f056dcb1708e6b6e8271aff6bf4c7d3 Mon Sep 17 00:00:00 2001 From: Otavio Santana Date: Tue, 8 Nov 2022 07:15:12 +0000 Subject: [PATCH] Add supplier methods Signed-off-by: Otavio Santana --- .../src/main/java/jakarta/nosql/Settings.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 a2f2fb754..de94bb210 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 @@ -66,6 +66,8 @@ public interface Settings { */ Optional get(String key); + Optional get(Supplier supplier); + /** * Returns the value to which the specified from one of these keys is mapped, or {@link Optional#empty()} * if this map contains no mapping for the key. @@ -75,7 +77,9 @@ public interface Settings { * if this map contains no mapping for the key * @throws NullPointerException when keys is null */ - Optional get(Collection keys); + Optional get(Iterable keys); + + Optional get(Iterable> suppliers); /** * Finds all keys that have the parameter as a prefix @@ -86,6 +90,8 @@ public interface Settings { */ List prefix(String prefix); + List prefix(Supplier supplier); + /** * Finds all keys that have the parameter as a prefix * @@ -93,7 +99,9 @@ public interface Settings { * @return all the keys from prefix * @throws NullPointerException when prefixes is null */ - List prefix(Collection prefixes); + List prefix(Iterable prefixes); + + List prefix(Iterable> suppliers); /** * Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. @@ -106,6 +114,8 @@ public interface Settings { */ Optional get(String key, Class type); + Optional get(Supplier supplier, Class type); + /** * Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key. * @@ -115,6 +125,8 @@ public interface Settings { */ Object getOrDefault(String key, Object defaultValue); + Object getOrDefault(Supplier supplier, Object defaultValue); + /** * @return Returns true if this map contains no key-value mappings. */