Interface GeneratorInitializer

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface GeneratorInitializer
Extension point for configuring a callback that is invoked immediately after a JsonGenerator is constructed by ObjectMapper or ObjectWriter, before the generator is used for serialization or returned to the caller.

The main use case is for format backends (such as XML) that need to initialize generator state (like writing an XML declaration) before content is written, but it can be useful for any format backend that needs generator-level initialization.

Instances can be configured via:

Since:
3.2
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method called immediately after a JsonGenerator is constructed, before it is used for serialization or returned to the caller.
  • Method Details