de.bild.codec.EnumCodecProvider 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.codecs.Codec;
import org.bson.codecs.configuration.CodecProvider;
import org.bson.codecs.configuration.CodecRegistry;
public class EnumCodecProvider implements CodecProvider {
@Override
public Codec get(Class clazz, CodecRegistry registry) {
if (clazz.isEnum()) {
return new EnumCodec(clazz);
}
return null;
}
}