- Type Parameters:
C - collection type
V - value type
- All Implemented Interfaces:
- TypeCodec<C>, org.bson.codecs.Codec<C>, org.bson.codecs.Decoder<C>, org.bson.codecs.Encoder<C>
- Direct Known Subclasses:
- ListTypeCodec, SetTypeCodec
public abstract class CollectionTypeCodec<C extends Collection<V>,V>
extends AbstractTypeCodec<C>
This codec encodes/decodes any Set and Map (see sub classes)
Note that this codec will never persist any addition properties declared in sub classes
Solely the collection values itself will be persisted.
The advantage is to keep declared methods of Collecton sub classes.
If you really need to persist additional fields with your map, think about using composition over inheritance.
Use a container class that holds a reference to a Collection.