Package org.bson.codecs
Class UuidCodec
java.lang.Object
org.bson.codecs.UuidCodec
- Direct Known Subclasses:
OverridableUuidRepresentationUuidCodec
Encodes and decodes
UUID objects.- Since:
- 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionThe constructor for UUIDCodec, default is JAVA_LEGACYUuidCodec(UuidRepresentation uuidRepresentation) The default UUIDRepresentation is JAVA_LEGACY to be compatible with existing documents -
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, UUID value, EncoderContext encoderContext) Encode an instance of the type parameterTinto a BSON value.Returns the Class instance that this encodes.TheUuidRepresentationwith which this instance is configuredtoString()
-
Constructor Details
-
UuidCodec
The default UUIDRepresentation is JAVA_LEGACY to be compatible with existing documents- Parameters:
uuidRepresentation- the representation of UUID- See Also:
-
UuidCodec
public UuidCodec()The constructor for UUIDCodec, default is JAVA_LEGACY
-
-
Method Details
-
getUuidRepresentation
TheUuidRepresentationwith which this instance is configured- Returns:
- the uuid representation
- Since:
- 3.12
-
encode
Description copied from interface:EncoderEncode an instance of the type parameterTinto a BSON value. -
decode
Description copied from interface:DecoderDecodes a BSON value from the given reader into an instance of the type parameterT. -
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<UUID>- Returns:
- the Class instance that this encodes.
-
toString
-