Class DefaultTypeSerializerRegistry

java.lang.Object
tech.guilhermekaua.spigotboot.config.serialization.DefaultTypeSerializerRegistry
All Implemented Interfaces:
TypeSerializerRegistry

public class DefaultTypeSerializerRegistry extends Object implements TypeSerializerRegistry
Default implementation of TypeSerializerRegistry.
  • 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: TypeSerializerRegistry
      Registers a serializer for a specific type.
      Specified by:
      register in interface TypeSerializerRegistry
      Type Parameters:
      T - the type parameter
      Parameters:
      type - the type to register
      serializer - the serializer for that type
    • unregister

      public void unregister(@NotNull @NotNull Class<?> type)
      Description copied from interface: TypeSerializerRegistry
      Unregisters the serializer for the given type, if present.
      Specified by:
      unregister in interface TypeSerializerRegistry
      Parameters:
      type - the type to unregister
    • get

      @Nullable public <T> @Nullable TypeSerializer<T> get(@NotNull @NotNull Class<T> type)
      Description copied from interface: TypeSerializerRegistry
      Gets the serializer for an exact type match.
      Specified by:
      get in interface TypeSerializerRegistry
      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: TypeSerializerRegistry
      Gets a serializer, checking superclasses and interfaces if no exact match exists.
      Specified by:
      getWithInheritance in interface TypeSerializerRegistry
      Type Parameters:
      T - the type parameter
      Parameters:
      type - the type to look up
      Returns:
      the serializer, or null if not found
    • copy

      @NotNull public @NotNull TypeSerializerRegistry copy()
      Description copied from interface: TypeSerializerRegistry
      Creates a copy of this registry.
      Specified by:
      copy in interface TypeSerializerRegistry
      Returns:
      a new registry with the same serializers