Custom Type Handler

This is the manual for older MicroStream versions (Version < 5.0).

The new documentation (Version >= 5.0) is located at:

https://docs.microstream.one/

Custom Type Handler allow taking control over the storing and loading procedure of specific java types. This is useful to optimize the performance for storing complex objects or in the rare case that it is not possible to store a type with the default type handlers.

Implementation

Suitable base class to start the implementation of a custom type handler for the Microstream standard binary storage implementation are:

one.microstream.persistence.binary.internal.AbstractBinaryHandlerCustomValue for simpler custom type handling in case only value have to be stored or one.microstream.persistence.binary.internal.AbstractBinaryHandlerCustom if the object own references that have to be persisted too.

Setup

The custom type handler must be registered in the CustomTypeHandlerRegistry to enable it:

mbeddedStorageManager storage = EmbeddedStorage
     .Foundation(WORKINGDIR)
     .onConnectionFoundation(f->
          f.registerCustomTypeHandlers(new CustomBufferedImageHandler()))
     .start(ROOT);

Last updated