Package org.bson.codecs
Class IterableCodec
- java.lang.Object
-
- org.bson.codecs.IterableCodec
-
- All Implemented Interfaces:
Codec<java.lang.Iterable>
,Decoder<java.lang.Iterable>
,Encoder<java.lang.Iterable>
,OverridableUuidRepresentationCodec<java.lang.Iterable>
public class IterableCodec extends java.lang.Object implements Codec<java.lang.Iterable>, OverridableUuidRepresentationCodec<java.lang.Iterable>
Encodes and decodesIterable
objects.- Since:
- 3.3
-
-
Constructor Summary
Constructors Constructor Description IterableCodec(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap)
Construct a new instance with the givenCodecRegistry
andBsonTypeClassMap
.IterableCodec(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap, Transformer valueTransformer)
Construct a new instance with the givenCodecRegistry
andBsonTypeClassMap
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable
decode(BsonReader reader, DecoderContext decoderContext)
Decodes a BSON value from the given reader into an instance of the type parameterT
.void
encode(BsonWriter writer, java.lang.Iterable value, EncoderContext encoderContext)
Encode an instance of the type parameterT
into a BSON value.java.lang.Class<java.lang.Iterable>
getEncoderClass()
Returns the Class instance that this encodes.Codec<java.lang.Iterable>
withUuidRepresentation(UuidRepresentation uuidRepresentation)
Implementations must return a new instance with theUuidRepresentation
overridden with the given value.
-
-
-
Constructor Detail
-
IterableCodec
public IterableCodec(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap)
Construct a new instance with the givenCodecRegistry
andBsonTypeClassMap
.- Parameters:
registry
- the non-null codec registrybsonTypeClassMap
- the non-null BsonTypeClassMap
-
IterableCodec
public IterableCodec(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap, Transformer valueTransformer)
Construct a new instance with the givenCodecRegistry
andBsonTypeClassMap
.- Parameters:
registry
- the non-null codec registrybsonTypeClassMap
- the non-null BsonTypeClassMapvalueTransformer
- the value Transformer
-
-
Method Detail
-
withUuidRepresentation
public Codec<java.lang.Iterable> withUuidRepresentation(UuidRepresentation uuidRepresentation)
Description copied from interface:OverridableUuidRepresentationCodec
Implementations must return a new instance with theUuidRepresentation
overridden with the given value.- Specified by:
withUuidRepresentation
in interfaceOverridableUuidRepresentationCodec<java.lang.Iterable>
- Parameters:
uuidRepresentation
- the UuidRepresentation- Returns:
- a new instance equivalent to this but with the given UuidRepresentation
-
decode
public java.lang.Iterable decode(BsonReader reader, DecoderContext decoderContext)
Description copied from interface:Decoder
Decodes a BSON value from the given reader into an instance of the type parameterT
.
-
encode
public void encode(BsonWriter writer, java.lang.Iterable value, EncoderContext encoderContext)
Description copied from interface:Encoder
Encode an instance of the type parameterT
into a BSON value.
-
getEncoderClass
public java.lang.Class<java.lang.Iterable> getEncoderClass()
Description copied from interface:Encoder
Returns the Class instance that this encodes. This is necessary because Java does not reify generic types.- Specified by:
getEncoderClass
in interfaceEncoder<java.lang.Iterable>
- Returns:
- the Class instance that this encodes.
-
-