ItemMapper { public PrimaryKey key(ByteBuffer byteBuffer) { try { return key(objectMapper.readTree(byteBuffer.array())); } catch (IOException e) { throw new RuntimeException(e); } }  PrimaryKey key(ByteBuffer byteBuffer); PrimaryKey key(JsonNode node); PrimaryKey primaryKey(Item item); Map<PrimaryKey, Item> mergeItems(List<ByteBuffer> list); List<Item> mergeItems(Collection<Item> created, Collection<Item> read); Item mergeItem(PrimaryKey primaryKey, Item newItem, Item oldItem); Object mergeValue(Object newObject, Object oldValue); Item fromByteBuffer(ByteBuffer byteBuffer); static final String CAMPAIGN_TABLE_HASH_KEY; static final String PERIOD_TABLE_RANGE_KEY; }
@Test public void key() throws Exception { for (Aggregation aggregation : aggregations) { byte[] bytes = mapper.writeValueAsBytes(aggregation); PrimaryKey primaryKey = itemMapper.key(ByteBuffer.wrap(bytes)); assertTrue(primaryKey.hasComponent(ItemMapper.CAMPAIGN_TABLE_HASH_KEY)); assertTrue(primaryKey.hasComponent(ItemMapper.PERIOD_TABLE_RANGE_KEY)); } }