CE-24 Create marshal for Map type ( in wire )

This commit is contained in:
Rob Austin
2015-04-27 19:15:51 +01:00
parent b7e500382d
commit ff9f0e32af
2 changed files with 10 additions and 6 deletions
@@ -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);
});
});