aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/kpref/KPref.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/kpref/KPref.kt')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kpref/KPref.kt10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPref.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPref.kt
index a45d66d..7f75370 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPref.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPref.kt
@@ -42,7 +42,7 @@ open class KPref private constructor(
internal val prefMap: MutableMap<String, ILazyResettable<*>> = mutableMapOf()
- fun add(entry : KPrefDelegate<*>) {
+ fun add(entry: KPrefDelegate<*>) {
if (prefMap.containsKey(entry.key))
throw KPrefException("${entry.key} is already used elsewhere in preference $preferenceName")
prefMap[entry.key] = entry
@@ -53,4 +53,12 @@ open class KPref private constructor(
}
operator fun get(key: String): ILazyResettable<*>? = prefMap[key]
+
+ /**
+ * Exposed key deletion function from builder.
+ * To avoid recursion, this type uses vararg
+ */
+ fun deleteKeys(vararg keys: String) {
+ deleteKeys(keys)
+ }
}