Class TypeSerializerCollection

    • Method Detail

      • get

        public <T> @Nullable TypeSerializer<T> get​(io.leangen.geantyref.TypeToken<T> token)
        Resolve a type serializer.

        First, all registered serializers from this collection are queried in registration order, then if a parent collection is set, that collection is queried.

        Type Parameters:
        T - the type to serialize
        Parameters:
        token - the type a serializer is required for
        Returns:
        a serializer if any is present, or null if no applicable serializer is found
        Since:
        4.0.0
      • get

        public <T> @Nullable TypeSerializer<T> get​(java.lang.Class<T> token)
        Resolve a type serializer.

        First, all registered serializers from this collection are queried in registration order, then if a parent collection is set, that collection is queried.

        This method will fail when provided a raw parameterized type

        Type Parameters:
        T - the type to serialize
        Parameters:
        token - the type a serializer is required for
        Returns:
        a serializer if any is present, or null if no applicable serializer is found
        Since:
        4.0.0
      • get

        public @Nullable TypeSerializer<?> get​(java.lang.reflect.Type type)
        Resolve a type serializer.

        First, all registered serializers from this collection are queried then if a parent collection is set, that collection is queried.

        Parameters:
        type - the type a serializer is required for
        Returns:
        a serializer if any is present, or null if no applicable serializer is found
        Since:
        4.0.0
      • get

        public @Nullable TypeSerializer<?> get​(java.lang.reflect.AnnotatedType type)
        Resolve a type serializer with annotation information.

        First, all registered serializers from this collection are queried then if a parent collection is set, that collection is queried.

        The returned serializer may not necessarily use the provided annotation information.

        Parameters:
        type - the type a serializer is required for
        Returns:
        a serializer if any is present, or null if no applicable serializer is found
        Since:
        4.2.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • builder

        public static TypeSerializerCollection.Builder builder()
        Create a builder for a new type serializer collection without a parent set.

        If any of the standard serializers provided by Configurate are desired, either the default collection or a collection inheriting from the default collection should be applied.

        Returns:
        the builder
        Since:
        4.0.0
      • defaults

        public static TypeSerializerCollection defaults()
        Get a collection containing all of Configurate's built-in type serializers.
        Returns:
        the collection
        Since:
        4.0.0