Class StandardCodecResolver
java.lang.Object
dev.scsupercraft.mc.libraries.corelib.serialization.resolver.basic.StandardCodecResolver
- All Implemented Interfaces:
CodecResolver
Used to resolve codecs for class that don't have type parameters.
You can register your own standard codecs using
You can register your own standard codecs using
SerializationEvent.RegisterStandardCodecEvent-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CodecHolder<T> Gets a codec holder for the provided class that was previously registered withSerializationEvent.RegisterStandardCodecEvent.static voidTriggers theSerializationEvent.RegisterStandardCodecEvent.<T> @NotNull CodecHolder<T> resolveCodec(GenericClass<T> genericClass) Resolves a codec for the provided generic class.booleansupportsValue(GenericClass<?> genericClass) Is the generic class supported by this codec resolver?
-
Constructor Details
-
StandardCodecResolver
public StandardCodecResolver()Creates a newStandardCodecResolver.
-
-
Method Details
-
refreshCodecs
public static void refreshCodecs()Triggers theSerializationEvent.RegisterStandardCodecEvent. -
get
Gets a codec holder for the provided class that was previously registered withSerializationEvent.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
Description copied from interface:CodecResolverIs the generic class supported by this codec resolver?- Specified by:
supportsValuein interfaceCodecResolver- Parameters:
genericClass- The generic class.- Returns:
- Is the generic class supported?
-
resolveCodec
Description copied from interface:CodecResolverResolves a codec for the provided generic class.Called only if
CodecResolver.supportsValue(GenericClass)returned true.- Specified by:
resolveCodecin interfaceCodecResolver- 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.
-