Class DefaultConverterManager

java.lang.Object
me.hsgamer.hscore.config.annotation.converter.manager.DefaultConverterManager

public final class DefaultConverterManager extends Object
A manager to specify a default Converter for a type
  • Method Details

    • registerProvider

      public static void registerProvider(ConverterProvider provider)
      Register a converter provider
      Parameters:
      provider - the provider
    • registerConverter

      public static void registerConverter(Type type, Converter converter)
      Register the converter for the type
      Parameters:
      type - the type class
      converter - the converter
    • unregisterConverter

      public static void unregisterConverter(Type type)
      Unregister the converter for the type
      Parameters:
      type - the type
    • getConverterIfDefault

      public static Converter getConverterIfDefault(Type type, Converter converter)
      Get the converter for the type if the given converter is the default one
      Parameters:
      type - the type
      converter - the converter
      Returns:
      the converter
    • getConverterIfDefault

      public static Converter getConverterIfDefault(Type type, Class<? extends Converter> converterClass)
      Get the converter for the type if the given converter is the default one
      Parameters:
      type - the type
      converterClass - the class of the converter
      Returns:
      the converter
    • getConverter

      public static Converter getConverter(Type type)
      Get the converter for the type
      Parameters:
      type - the type
      Returns:
      the converter