Package org.bson.codecs
Class IterableCodec
java.lang.Object
org.bson.codecs.IterableCodec
- All Implemented Interfaces:
Codec<Iterable<Object>>,Decoder<Iterable<Object>>,Encoder<Iterable<Object>>,OverridableUuidRepresentationCodec<Iterable<Object>>,Parameterizable
public class IterableCodec
extends Object
implements OverridableUuidRepresentationCodec<Iterable<Object>>, Parameterizable
Encodes and decodes
Iterable objects.- Since:
- 3.3
-
Constructor Summary
ConstructorsConstructorDescriptionIterableCodec(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap) Construct a new instance with the givenCodecRegistryandBsonTypeClassMap.IterableCodec(CodecRegistry registry, BsonTypeClassMap bsonTypeClassMap, Transformer valueTransformer) Construct a new instance with the givenCodecRegistryandBsonTypeClassMap. -
Method Summary
Modifier and TypeMethodDescriptiondecode(BsonReader reader, DecoderContext decoderContext) Decodes a BSON value from the given reader into an instance of the type parameterT.voidencode(BsonWriter writer, Iterable<Object> value, EncoderContext encoderContext) Encode an instance of the type parameterTinto a BSON value.Returns the Class instance that this encodes.Codec<?>parameterize(CodecRegistry codecRegistry, List<Type> types) Recursively parameterize the codec with the given registry and generic type arguments.withUuidRepresentation(UuidRepresentation uuidRepresentation) Implementations must return a new instance with theUuidRepresentationoverridden with the given value.
-
Constructor Details
-
IterableCodec
Construct a new instance with the givenCodecRegistryandBsonTypeClassMap.- 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 givenCodecRegistryandBsonTypeClassMap.- Parameters:
registry- the non-null codec registrybsonTypeClassMap- the non-null BsonTypeClassMapvalueTransformer- the value Transformer
-
-
Method Details
-
parameterize
Description copied from interface:ParameterizableRecursively parameterize the codec with the given registry and generic type arguments.- Specified by:
parameterizein interfaceParameterizable- Parameters:
codecRegistry- the code registry to use to resolve codecs for the generic type argumentstypes- the types that are parameterizing the containing type.- Returns:
- the Codec parameterized with the given types
-
withUuidRepresentation
Description copied from interface:OverridableUuidRepresentationCodecImplementations must return a new instance with theUuidRepresentationoverridden with the given value.- Specified by:
withUuidRepresentationin interfaceOverridableUuidRepresentationCodec<Iterable<Object>>- Parameters:
uuidRepresentation- the UuidRepresentation- Returns:
- a new instance equivalent to this but with the given UuidRepresentation
-
decode
Description copied from interface:DecoderDecodes a BSON value from the given reader into an instance of the type parameterT. -
encode
Description copied from interface:EncoderEncode an instance of the type parameterTinto a BSON value. -
getEncoderClass
Description copied from interface:EncoderReturns the Class instance that this encodes. This is necessary because Java does not reify generic types.- Specified by:
getEncoderClassin interfaceEncoder<T>- Returns:
- the Class instance that this encodes.
-