mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
CE-24 Create marshal for Map type ( in wire )
This commit is contained in:
@@ -166,7 +166,10 @@ public class EngineMap<K, V> implements ChronicleMap<K, V> {
|
||||
@Override
|
||||
public V put(final K key, final V value) {
|
||||
nullCheck(key);
|
||||
return toObject(vClass, () -> map.put(bytes(key), bytes(value)));
|
||||
return toObject(vClass, () -> {
|
||||
final byte[] put = map.put(bytes(key), bytes(value));
|
||||
return put;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -304,8 +304,7 @@ public class MapWireHandler<K, V> implements WireHandler, Consumer<WireHandlers>
|
||||
// todo remove the toByteArray(..)
|
||||
writeValueUsingDelegate(map -> {
|
||||
final byte[] key = toByteArray(valueIn);
|
||||
final byte[] value = map.get(key);
|
||||
return value;
|
||||
return map.get(key);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -316,9 +315,11 @@ public class MapWireHandler<K, V> implements WireHandler, Consumer<WireHandlers>
|
||||
|
||||
final Params[] params = getAndPut.params();
|
||||
|
||||
MapWireHandler.this.writeValue(b -> b.put(
|
||||
wire.read(params[0]).bytes(),
|
||||
wire.read(params[1]).bytes()));
|
||||
MapWireHandler.this.writeValue(b -> {
|
||||
byte[] k = wire.read(params[0]).bytes();
|
||||
byte[] v = wire.read(params[1]).bytes();
|
||||
return b.put(k, v);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user