Package org.bson.codecs
Interface Encoder<T>
- Type Parameters:
T
- the type that the instance can encode into BSON
- All Known Subinterfaces:
Codec<T>
,CollectibleCodec<T>
- All Known Implementing Classes:
AtomicBooleanCodec
,AtomicIntegerCodec
,AtomicLongCodec
,BigDecimalCodec
,BinaryCodec
,BooleanCodec
,BsonArrayCodec
,BsonBinaryCodec
,BsonBooleanCodec
,BsonCodec
,BsonDateTimeCodec
,BsonDBPointerCodec
,BsonDecimal128Codec
,BsonDocumentCodec
,BsonDocumentWrapperCodec
,BsonDoubleCodec
,BsonInt32Codec
,BsonInt64Codec
,BsonJavaScriptCodec
,BsonJavaScriptWithScopeCodec
,BsonMaxKeyCodec
,BsonMinKeyCodec
,BsonNullCodec
,BsonObjectIdCodec
,BsonRegularExpressionCodec
,BsonStringCodec
,BsonSymbolCodec
,BsonTimestampCodec
,BsonUndefinedCodec
,BsonValueCodec
,ByteArrayCodec
,ByteCodec
,CharacterCodec
,CodeCodec
,CodeWithScopeCodec
,DateCodec
,Decimal128Codec
,DocumentCodec
,DoubleCodec
,EnumCodec
,FloatCodec
,InstantCodec
,IntegerCodec
,IterableCodec
,JsonObjectCodec
,LocalDateCodec
,LocalDateTimeCodec
,LocalTimeCodec
,LongCodec
,MapCodec
,MaxKeyCodec
,MinKeyCodec
,ObjectIdCodec
,OverridableUuidRepresentationUuidCodec
,PatternCodec
,RawBsonDocumentCodec
,ShortCodec
,StringCodec
,SymbolCodec
,UuidCodec
public interface Encoder<T>
Instances of this class are capable of encoding an instance of the type parameter
T
into a BSON value.
.- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(BsonWriter writer, T value, EncoderContext encoderContext) Encode an instance of the type parameterT
into a BSON value.Returns the Class instance that this encodes.
-
Method Details
-
encode
Encode an instance of the type parameterT
into a BSON value.- Parameters:
writer
- the BSON writer to encode intovalue
- the value to encodeencoderContext
- the encoder context
-
getEncoderClass
Returns the Class instance that this encodes. This is necessary because Java does not reify generic types.- Returns:
- the Class instance that this encodes.
-