Class DefaultTypeSerializerRegistry
java.lang.Object
tech.guilhermekaua.spigotboot.config.serialization.DefaultTypeSerializerRegistry
- All Implemented Interfaces:
TypeSerializerRegistry
Default implementation of
TypeSerializerRegistry.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull TypeSerializerRegistrycopy()Creates a copy of this registry.<T> @Nullable TypeSerializer<T>Gets the serializer for an exact type match.<T> @Nullable TypeSerializer<T>getWithInheritance(@NotNull Class<T> type) Gets a serializer, checking superclasses and interfaces if no exact match exists.<T> voidregister(@NotNull Class<T> type, @NotNull TypeSerializer<T> serializer) Registers a serializer for a specific type.voidunregister(@NotNull Class<?> type) Unregisters the serializer for the given type, if present.
-
Constructor Details
-
DefaultTypeSerializerRegistry
public DefaultTypeSerializerRegistry()
-
-
Method Details
-
register
public <T> void register(@NotNull @NotNull Class<T> type, @NotNull @NotNull TypeSerializer<T> serializer) Description copied from interface:TypeSerializerRegistryRegisters a serializer for a specific type.- Specified by:
registerin interfaceTypeSerializerRegistry- Type Parameters:
T- the type parameter- Parameters:
type- the type to registerserializer- the serializer for that type
-
unregister
Description copied from interface:TypeSerializerRegistryUnregisters the serializer for the given type, if present.- Specified by:
unregisterin interfaceTypeSerializerRegistry- Parameters:
type- the type to unregister
-
get
Description copied from interface:TypeSerializerRegistryGets the serializer for an exact type match.- Specified by:
getin interfaceTypeSerializerRegistry- Type Parameters:
T- the type parameter- Parameters:
type- the type to look up- Returns:
- the serializer, or null if not found
-
getWithInheritance
@Nullable public <T> @Nullable TypeSerializer<T> getWithInheritance(@NotNull @NotNull Class<T> type) Description copied from interface:TypeSerializerRegistryGets a serializer, checking superclasses and interfaces if no exact match exists.- Specified by:
getWithInheritancein interfaceTypeSerializerRegistry- Type Parameters:
T- the type parameter- Parameters:
type- the type to look up- Returns:
- the serializer, or null if not found
-
copy
Description copied from interface:TypeSerializerRegistryCreates a copy of this registry.- Specified by:
copyin interfaceTypeSerializerRegistry- Returns:
- a new registry with the same serializers
-