コード例 #1
0
  @Override
  public ScopedRowKey<K> fromByteBuffer(final ByteBuffer byteBuffer) {
    final CompositeParser parser = Composites.newCompositeParser(byteBuffer);

    // read back the id
    final Id orgId = ID_SER.fromComposite(parser);

    final K value = keySerializer.fromComposite(parser);

    return new ScopedRowKey<K>(orgId, value);
  }
コード例 #2
0
  @Override
  public ByteBuffer toByteBuffer(final ScopedRowKey<K> scopedRowKey) {

    final CompositeBuilder builder = Composites.newCompositeBuilder();

    // add the organization's id
    ID_SER.toComposite(builder, scopedRowKey.getScope());

    // add the key type
    keySerializer.toComposite(builder, scopedRowKey.getKey());

    return builder.build();
  }