Class Serializers


  • public class Serializers
    extends java.lang.Object
    Serializer Utilities class
    Since:
    1.0.0
    Author:
    Mercy
    • Constructor Summary

      Constructors 
      Constructor Description
      Serializers()  
      Serializers​(java.lang.ClassLoader classLoader)  
    • Constructor Detail

      • Serializers

        public Serializers​(java.lang.ClassLoader classLoader)
      • Serializers

        public Serializers()
    • Method Detail

      • loadSPI

        public void loadSPI()
      • getMostCompatible

        public Serializer<?> getMostCompatible​(java.lang.Class<?> serializedType)
        Get the most compatible instance of Serializer by the specified deserialized type
        Parameters:
        serializedType - the type to be serialized
        Returns:
        null if not found
      • getHighestPriority

        public <S> Serializer<S> getHighestPriority​(java.lang.Class<S> serializedType)
        Get the highest priority instance of Serializer by the specified serialized type
        Type Parameters:
        S - the type to be serialized
        Parameters:
        serializedType - the type to be serialized
        Returns:
        null if not found
      • getLowestPriority

        public <S> Serializer<S> getLowestPriority​(java.lang.Class<S> serializedType)
        Get the lowest priority instance of Serializer by the specified serialized type
        Type Parameters:
        S - the type to be serialized
        Parameters:
        serializedType - the type to be serialized
        Returns:
        null if not found
      • get

        public <S> java.util.List<Serializer<S>> get​(java.lang.Class<S> serializedType)
        Get all instances of Serializer by the specified serialized type
        Type Parameters:
        S - the type to be serialized
        Parameters:
        serializedType - the type to be serialized
        Returns:
        non-null List