Modifier and Type | Field and Description |
---|---|
private UuidRepresentation |
decoderUuidRepresentation |
private UuidRepresentation |
encoderUuidRepresentation |
Constructor and Description |
---|
UuidCodec()
The constructor for UUIDCodec, default is JAVA_LEGACY
|
UuidCodec(UuidRepresentation uuidRepresentation)
The default UUIDRepresentation is JAVA_LEGACY to be compatible with existing documents
|
Modifier and Type | Method and Description |
---|---|
java.util.UUID |
decode(BsonReader reader,
DecoderContext decoderContext)
Decodes a BSON value from the given reader into an instance of the type parameter
T . |
void |
encode(BsonWriter writer,
java.util.UUID value,
EncoderContext encoderContext)
Encode an instance of the type parameter
T into a BSON value. |
java.lang.Class<java.util.UUID> |
getEncoderClass()
Returns the Class instance that this encodes.
|
private static long |
readLongFromArrayBigEndian(byte[] bytes,
int offset) |
private static void |
writeLongToArrayBigEndian(byte[] bytes,
int offset,
long x) |
private final UuidRepresentation encoderUuidRepresentation
private final UuidRepresentation decoderUuidRepresentation
public UuidCodec(UuidRepresentation uuidRepresentation)
uuidRepresentation
- the representation of UUIDUuidRepresentation
public UuidCodec()
public void encode(BsonWriter writer, java.util.UUID value, EncoderContext encoderContext)
Encoder
T
into a BSON value.public java.util.UUID decode(BsonReader reader, DecoderContext decoderContext)
Decoder
T
.public java.lang.Class<java.util.UUID> getEncoderClass()
Encoder
getEncoderClass
in interface Encoder<java.util.UUID>
private static void writeLongToArrayBigEndian(byte[] bytes, int offset, long x)
private static long readLongFromArrayBigEndian(byte[] bytes, int offset)