- java.lang.Object
-
- xyz.tozymc.configuration.serialization.TcConfigSerializations
-
public final class TcConfigSerializations extends Object
Backend for object serialization.- Since:
- 1.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearCache()Clears the reflection cache.static <T> TdeserializeObject(@NotNull Class<T> type, Map<String,?> serialized)Creates new object from represented map.static voidregisterSerializer(@NotNull TcConfigSerializer<?> serializer)Registers the serializer to the backend.static voidregisterSerializers(TcConfigSerializer<?> @NotNull ... serializers)Registers the serializers to the backend.static @NotNull Map<String,?>serializeObject(@NotNull Object object)Creates map represented the object.static voidunregisterSerializer(@NotNull TcConfigSerializer<?> serializer)Unregisters the serializer to the backend.static voidunregisterSerializers(TcConfigSerializer<?> @NotNull ... serializers)Unregisters the serializers to the backend.
-
-
-
Method Detail
-
clearCache
public static void clearCache()
Clears the reflection cache.ReflectionCachecache constructor, and field need for serialization.
-
registerSerializer
public static void registerSerializer(@NotNull @NotNull TcConfigSerializer<?> serializer)
Registers the serializer to the backend.- Parameters:
serializer- Serializer to register.- Throws:
IllegalStateException- Thrown when serializer is registered.
-
registerSerializers
public static void registerSerializers(TcConfigSerializer<?> @NotNull ... serializers)
Registers the serializers to the backend.- Parameters:
serializers- Serializers to register.- Throws:
IllegalStateException- Thrown when serializer is registered.
-
unregisterSerializer
public static void unregisterSerializer(@NotNull @NotNull TcConfigSerializer<?> serializer)
Unregisters the serializer to the backend.- Parameters:
serializer- Serializer to unregister.- Throws:
IllegalStateException- Thrown when serializer isn't registered.
-
unregisterSerializers
public static void unregisterSerializers(TcConfigSerializer<?> @NotNull ... serializers)
Unregisters the serializers to the backend.- Parameters:
serializers- Serializers to unregister.- Throws:
IllegalStateException- Thrown when serializer isn't registered.
-
serializeObject
@NotNull public static @NotNull Map<String,?> serializeObject(@NotNull @NotNull Object object)
Creates map represented the object.- Parameters:
object- Object to serialize- Returns:
- Map represented the object.
- Throws:
TcConfigSerializationException- Thrown when no serializer represented the type.
-
deserializeObject
@NotNull public static <T> T deserializeObject(@NotNull @NotNull Class<T> type, Map<String,?> serialized)
Creates new object from represented map.- Type Parameters:
T- Type of serializable object.- Parameters:
type- The class type of deserializable object.serialized- Map represented the object.- Returns:
- New object created from represented map.
- Throws:
TcConfigSerializationException- Thrown when no serializer represented the type.
-
-