mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-03 06:19:37 +00:00
perf[orm]: optimize codec registration
This commit is contained in:
@@ -41,7 +41,7 @@ public class IntMapCodec<V> implements Codec<Map<Integer, V>> {
|
||||
@Override
|
||||
public Map<Integer, V> decode(final BsonReader reader, final DecoderContext context) {
|
||||
reader.readStartDocument();
|
||||
Map<Integer, V> map = new HashMap<>();
|
||||
var map = new HashMap<Integer, V>();
|
||||
while (!BsonType.END_OF_DOCUMENT.equals(reader.readBsonType())) {
|
||||
int key = Integer.parseInt(reader.readName());
|
||||
V value = BsonType.NULL.equals(reader.getCurrentBsonType()) ? null : valueCodec.decode(reader, context);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LongMapCodec<V> implements Codec<Map<Long, V>> {
|
||||
@Override
|
||||
public Map<Long, V> decode(final BsonReader reader, final DecoderContext context) {
|
||||
reader.readStartDocument();
|
||||
Map<Long, V> map = new HashMap<>();
|
||||
var map = new HashMap<Long, V>();
|
||||
while (!BsonType.END_OF_DOCUMENT.equals(reader.readBsonType())) {
|
||||
long key = Long.parseLong(reader.readName());
|
||||
V value = BsonType.NULL.equals(reader.getCurrentBsonType()) ? null : valueCodec.decode(reader, context);
|
||||
|
||||
Reference in New Issue
Block a user