java.lang.Object
dev.scsupercraft.mc.libraries.corelib.serialization.resolver.basic.StandardCodecResolver
All Implemented Interfaces:
CodecResolver

public final class StandardCodecResolver extends Object implements CodecResolver
Used to resolve codecs for class that don't have type parameters.

You can register your own standard codecs using SerializationEvent.RegisterStandardCodecEvent
  • Constructor Details

  • Method Details

    • refreshCodecs

      public static void refreshCodecs()
    • get

      public static <T> CodecHolder<T> get(Class<T> tClass)
      Gets a codec holder for the provided class that was previously registered with SerializationEvent.RegisterStandardCodecEvent.
      Type Parameters:
      T - The type of class.
      Parameters:
      tClass - The class to get a codec holder for.
      Returns:
      The codec holder, or null if there was no registered codec holder.
    • supportsValue

      public boolean supportsValue(GenericClass<?> genericClass)
      Description copied from interface: CodecResolver
      Is the generic class supported by this codec resolver?
      Specified by:
      supportsValue in interface CodecResolver
      Parameters:
      genericClass - The generic class.
      Returns:
      Is the generic class supported?
    • resolveCodec

      @NotNull public <T> @NotNull CodecHolder<T> resolveCodec(GenericClass<T> genericClass)
      Description copied from interface: CodecResolver
      Resolves a codec for the provided generic class.

      Called only if CodecResolver.supportsValue(GenericClass) returned true.

      Specified by:
      resolveCodec in interface CodecResolver
      Type Parameters:
      T - The type of class contained in the generic class.
      Parameters:
      genericClass - The generic class.
      Returns:
      A codec holder containing the codecs for the provided generic class.