From 5618d6bee139aac796f895237adab9a7484c1306 Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 13 Jan 2018 23:59:51 +0100 Subject: [PATCH] added register(Class clazz, int id); --- src/dorkbox/util/SerializationManager.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/dorkbox/util/SerializationManager.java b/src/dorkbox/util/SerializationManager.java index e069522..227a33a 100644 --- a/src/dorkbox/util/SerializationManager.java +++ b/src/dorkbox/util/SerializationManager.java @@ -42,6 +42,20 @@ interface SerializationManager { */ SerializationManager register(Class clazz); + /** + * Registers the class using the specified ID. If the ID is + * already in use by the same type, the old entry is overwritten. If the ID + * is already in use by a different type, a {@link KryoException} is thrown. + * Registering a primitive also affects the corresponding primitive wrapper. + *

+ * IDs must be the same at deserialization as they were for serialization. + * + * @param id Must be >= 0. Smaller IDs are serialized more efficiently. IDs + * 0-8 are used by default for primitive types and String, but + * these IDs can be repurposed. + */ + SerializationManager register(Class clazz, int id); + /** * Registers the class using the lowest, next available integer ID and the * specified serializer. If the class is already registered, the existing