Interface EntityConverter<T>

Type Parameters:
T - the type parameter
All Superinterfaces:
AutoCloseable, NitritePlugin

public interface EntityConverter<T> extends NitritePlugin
The EntityConverter interface is used to convert an entity of type EntityConverter into a database Document and vice versa.
Since:
4.0
Author:
Anindya Chatterjee
  • Method Details

    • getEntityType

      Class<T> getEntityType()
      Gets the entity type.
      Returns:
      the entity type
    • toDocument

      Document toDocument(T entity, NitriteMapper nitriteMapper)
      Converts the entity to a Document.
      Parameters:
      entity - the entity
      nitriteMapper - the nitrite mapper
      Returns:
      the document
    • fromDocument

      T fromDocument(Document document, NitriteMapper nitriteMapper)
      Converts a Document to an entity of type EntityConverter.
      Parameters:
      document - the document
      nitriteMapper - the nitrite mapper
      Returns:
      the t
    • initialize

      default void initialize(NitriteConfig nitriteConfig)
      Description copied from interface: NitritePlugin
      Initializes the plugin instance.
      Specified by:
      initialize in interface NitritePlugin
      Parameters:
      nitriteConfig - the nitrite config