de.bild.codec.ReflectionCodec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of polymorphia Show documentation
Show all versions of polymorphia Show documentation
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
package de.bild.codec;
import org.bson.BsonReader;
import org.bson.BsonWriter;
import org.bson.codecs.DecoderContext;
import org.bson.codecs.EncoderContext;
import java.util.Map;
/**
*
* @param the value type
*/
public interface ReflectionCodec extends TypeCodec {
Map getPersistenceFields();
T decodeFields(BsonReader reader, DecoderContext decoderContext, T instance);
void encodeFields(BsonWriter writer, T instance, EncoderContext encoderContext);
default void postDecode(T instance) {
// do nothing
}
default void preEncode(T instance) {
// solely meant to not introduce braking changes
}
void initializeDefaults(T instance);
MappedField getMappedField(String mappedFieldName);
MappedField getIdField();
}