Package io.vena.bosk.drivers.mongo
Class BsonPlugin
java.lang.Object
io.vena.bosk.SerializationPlugin
io.vena.bosk.drivers.mongo.BsonPlugin
public final class BsonPlugin
extends io.vena.bosk.SerializationPlugin
-
Nested Class Summary
Nested classes/interfaces inherited from class io.vena.bosk.SerializationPlugin
io.vena.bosk.SerializationPlugin.DeserializationScope -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R extends io.vena.bosk.StateTreeNode>
org.bson.codecs.configuration.CodecProvidercodecProviderFor(io.vena.bosk.Bosk<R> bosk) Note that theCodecProviderisClass-based, so it has anemic type information for generics due to type erasure.<T,R extends io.vena.bosk.StateTreeNode>
org.bson.codecs.Codec<T>getCodec(Type targetType, Class<T> targetClass, org.bson.codecs.configuration.CodecRegistry registry, io.vena.bosk.Bosk<R> bosk) LikecodecProviderFor(bosk).get(targetType, registry)except this works more broadly because it can accept aParameterizedTypefor generic classes.Methods inherited from class io.vena.bosk.SerializationPlugin
entryDeserializationScope, hasDeserializationPath, isEnclosingReference, isImplicitParameter, isSelfReference, newDeserializationScope, newDeserializationScope, nodeFieldDeserializationScope, overlayScope, parameterValueList
-
Constructor Details
-
BsonPlugin
public BsonPlugin()
-
-
Method Details
-
codecProviderFor
public <R extends io.vena.bosk.StateTreeNode> org.bson.codecs.configuration.CodecProvider codecProviderFor(io.vena.bosk.Bosk<R> bosk) Note that theCodecProviderisClass-based, so it has anemic type information for generics due to type erasure. Because of this, the returnedCodecProvideris unable to provideCodecs for certain generic types.In response to this shortcoming, you can access
Codecs for any type usinggetCodec(Type, Class, CodecRegistry, Bosk) -
getCodec
public <T,R extends io.vena.bosk.StateTreeNode> org.bson.codecs.Codec<T> getCodec(Type targetType, Class<T> targetClass, org.bson.codecs.configuration.CodecRegistry registry, io.vena.bosk.Bosk<R> bosk) LikecodecProviderFor(bosk).get(targetType, registry)except this works more broadly because it can accept aParameterizedTypefor generic classes.- Type Parameters:
R- root type ofbosk- Parameters:
targetClass- must matchtargetType. This is provided only to help Java do type inference and avoid ugly and unnecessary type casts.
-