Interface UnknownPropertyHandler

  • All Known Implementing Classes:
    EvolvableHandler

    public interface UnknownPropertyHandler
    An interface that defines callbacks that will be called when an unknown properties are encountered during deserialization, as well as to check if there are any unknown properties that should be written out during serialization.

    The main purpose of this interface is to support schema evolution of objects that use JSON as a long term storage format, without loss of unknown properties across clients and severs using different versions of Java classes.

    Author:
    Aleks Seovic 2018.05.09
    • Method Detail

      • writeUnknownProperties

        default <T> void writeUnknownProperties​(T bean,
                                                ObjectWriter writer,
                                                Context ctx)
        Write unknown properties encountered during deserialization.

        This method can be optionally implemented by UnknownPropertyHandlers that want to write unknown properties during serialization. The default implementation is a no-op.

        Parameters:
        bean - the object we are serializing into JSON
        writer - the ObjectReader to read property value from
        ctx - serialization context