Class DfuSerializers

java.lang.Object
org.spongepowered.configurate.extra.dfu.v7.DfuSerializers

public final class DfuSerializers extends Object
A bridge between Configurate and DataFixerUpper serialization types.
Since:
4.3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static <S> @Nullable com.mojang.serialization.Codec<S>
    codec(io.leangen.geantyref.TypeToken<S> type)
    Create a new codec that uses the default type serializer collection to serialize an object of the provided type.
    static <V> @Nullable com.mojang.serialization.Codec<V>
    codec(io.leangen.geantyref.TypeToken<V> type, TypeSerializerCollection collection)
    Create a new codec based on a Configurate TypeSerializer.
    static <V> TypeSerializer<V>
    serializer(com.mojang.serialization.Codec<V> codec)
    Create a new serializer wrapping the provided Codec.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • serializer

      public static <V> TypeSerializer<V> serializer(com.mojang.serialization.Codec<V> codec)
      Create a new serializer wrapping the provided Codec.
      Type Parameters:
      V - value type
      Parameters:
      codec - codec to use for the serialization operation
      Returns:
      a new serializer
      Since:
      4.3.0
    • codec

      public static <S> @Nullable com.mojang.serialization.Codec<S> codec(io.leangen.geantyref.TypeToken<S> type)
      Create a new codec that uses the default type serializer collection to serialize an object of the provided type.
      Type Parameters:
      S - value type
      Parameters:
      type - token representing a value type
      Returns:
      a codec for the type, or null if an appropriate TypeSerializer could not be found.
      Since:
      4.3.0
    • codec

      public static <V> @Nullable com.mojang.serialization.Codec<V> codec(io.leangen.geantyref.TypeToken<V> type, TypeSerializerCollection collection)
      Create a new codec based on a Configurate TypeSerializer.
      Type Parameters:
      V - value type
      Parameters:
      type - type to serialize
      collection - source for values
      Returns:
      a codec, or null if an appropriate TypeSerializer could not be found for the TypeToken.
      Since:
      4.3.0