diff --git a/README.md b/README.md
index 71c9818..d012bc5 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Maven Info
com.dorkbox
Serializers
- 2.6
+ 2.7
```
diff --git a/build.gradle.kts b/build.gradle.kts
index ddaeedb..7b5881c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,7 +37,7 @@ object Extras {
// set for the project
const val description = "Kryo based serializers"
const val group = "com.dorkbox"
- const val version = "2.6"
+ const val version = "2.7"
// set as project.ext
const val name = "Serializers"
diff --git a/src/dorkbox/serializers/SerializationDefaults.kt b/src/dorkbox/serializers/SerializationDefaults.kt
index ad5401b..c622954 100644
--- a/src/dorkbox/serializers/SerializationDefaults.kt
+++ b/src/dorkbox/serializers/SerializationDefaults.kt
@@ -16,6 +16,8 @@
package dorkbox.serializers
import com.esotericsoftware.kryo.Kryo
+import com.esotericsoftware.kryo.Registration
+import com.esotericsoftware.kryo.Serializer
import java.io.File
import java.io.IOException
import java.math.BigDecimal
@@ -31,7 +33,7 @@ object SerializationDefaults {
/**
* Gets the version number.
*/
- const val version = "2.6"
+ const val version = "2.7"
init {
// Add this project to the updates system, which verifies this class + UUID + version information
@@ -54,6 +56,27 @@ object SerializationDefaults {
val inet6AddressSerializer by lazy { Inet6AddressSerializer() }
val fileSerializer by lazy { FileSerializer() }
+ /**
+ * Allows for the kryo registration of sensible defaults in a common, well-used way. Uses a hashmap to return registration data
+ */
+ fun register(): MutableMap, Serializer<*>?> {
+ val registeredClasses: MutableMap, Serializer<*>?> = mutableMapOf()
+ val kryo = object : Kryo() {
+ override fun register(type: Class<*>): Registration {
+ registeredClasses[type] = null
+ return super.register(type)
+ }
+
+ override fun register(type: Class<*>, serializer: Serializer<*>?): Registration {
+ registeredClasses[type] = serializer
+ return super.register(type, serializer)
+ }
+ }
+
+ register(kryo)
+ return registeredClasses
+ }
+
/**
* Allows for the kryo registration of sensible defaults in a common, well-used way.
*/