diff --git a/gradle.properties b/gradle.properties index 3501c24..caf963d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official specifyKotlinAsDependency=false projectGroup=ru.dbotthepony.kommons -projectVersion=2.8.1 +projectVersion=2.8.2 guavaDepVersion=33.0.0 gsonDepVersion=2.8.9 diff --git a/src/main/kotlin/ru/dbotthepony/kommons/io/DelegateSyncher.kt b/src/main/kotlin/ru/dbotthepony/kommons/io/DelegateSyncher.kt index ef4be86..37dbaf4 100644 --- a/src/main/kotlin/ru/dbotthepony/kommons/io/DelegateSyncher.kt +++ b/src/main/kotlin/ru/dbotthepony/kommons/io/DelegateSyncher.kt @@ -507,14 +507,21 @@ class DelegateSyncher : Observer { return add(ListenableDelegate.maskSmart(value, getter, setter), DecimalValueCodec) } + @JvmOverloads fun set(codec: StreamCodec, backing: MutableSet = ObjectOpenHashSet()): SetSlot { return add(ListenableSet(backing), codec) } + @JvmOverloads fun map(keyCodec: StreamCodec, valueCodec: StreamCodec, backing: MutableMap = Object2ObjectOpenHashMap()): MapSlot { return add(ListenableMap(backing), keyCodec, valueCodec) } + @JvmOverloads + fun > enum(value: E, setter: DelegateSetter = DelegateSetter.passthrough(), getter: DelegateGetter = DelegateGetter.passthrough()): Slot { + return add(ListenableDelegate.maskSmart(value, getter, setter), StreamCodec.Enum(value::class.java)) + } + /** * Remotes must be [close]d when no longer in use, otherwise they will * leak memory and decrease performance of syncher.