use of com.torodb.kvdocument.values.heap.ByteArrayKvMongoObjectId in project torodb by torodb.
the class MapToKvValueConverter method buildSpecialObject.
private KvValue<?> buildSpecialObject(Map<String, Object> map) {
Entry<String, Object> first = map.entrySet().iterator().next();
String key = first.getKey();
Object value = first.getValue();
if ("$oid".equals(key) && value instanceof String) {
return new ByteArrayKvMongoObjectId(HexUtils.hex2Bytes((String) value));
}
if ("$date".equals(key)) {
return parseDate(key, value);
}
throw new RuntimeException("Unexpected special object type: " + key);
}
use of com.torodb.kvdocument.values.heap.ByteArrayKvMongoObjectId in project torodb by torodb.
the class PostgreSqlValueToCopyConverterTest method testMongoObjectId.
@Test
public void testMongoObjectId() {
KvMongoObjectId mongoObjectIdValue = new ByteArrayKvMongoObjectId(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc });
mongoObjectIdValue.accept(visitor, sb);
assertEquals("\\\\x0102030405060708090A0B0C", sb.toString());
}
Aggregations