Class NullConverterFactory

  • All Implemented Interfaces:
    Factory<Converter<?>>

    public class NullConverterFactory
    extends ChainedFactory
    The default implementation handles null values by returning the predefined default value if any or null during deserialization and by calling writer.writeNull() during serialization.

    Author:
    Eugen Cepoi
    • Constructor Detail

      • NullConverterFactory

        public NullConverterFactory​(boolean failOnNullPrimitive)
    • Method Detail

      • create

        protected Converter<?> create​(Type type,
                                      Genson genson,
                                      Converter<?> nextConverter)
        Description copied from class: ChainedFactory
        This method will be called by ChainedFactory.create(Type, Genson) with nextConverter being the converter created for current type by the next factory. This means that ChainedFactory will first create a converter with the next factory and then use it's own create method.
        Specified by:
        create in class ChainedFactory
        Parameters:
        type - for which this factory must provide a converter
        genson - instance that you can use when you need a converter for some other type (for example a converter of List<Integer> will need a converter for Integer type).
        nextConverter - created by the next factory, may be null.
        Returns:
        null or a converter for this type