All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.bild.codec.InstanceAwareIdGenerator Maven / Gradle / Ivy

Go to download

A very fast POJO codec for MongoDB (used in conjunction with the Mongo Java Driver) that handles generic types as well as polymorphic class hierarchies

The newest version!
package de.bild.codec;

import org.bson.BsonDocumentWrapper;
import org.bson.BsonValue;

/**
 * Introducing this super-interface of {@link IdGenerator} allows for staying backward compatible with existing code.
 * @param  type of the id class
 * @param 

type of the entity instance class */ public interface InstanceAwareIdGenerator { T generate(P instance); default BsonValue asBsonValue(T id, TypeCodecRegistry typeCodecRegistry) { return BsonDocumentWrapper.asBsonDocument(id, typeCodecRegistry.getRegistry()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy