package me.prettyprint.cassandra.serializers;

import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;

import me.prettyprint.hector.api.Serializer;


/**
 * The BytesExtractor is a simple identity function. It supports the Extractor interface and
 * implements the fromBytes and toBytes as simple identity functions.
 *
 * @author Ran Tavory
 *
 */
public final class ByteBufferSerializer extends AbstractSerializer<ByteBuffer> implements Serializer<ByteBuffer>{

  private static ByteBufferSerializer instance = new ByteBufferSerializer();

  public static ByteBufferSerializer get() {
    return instance;
  }

  @Override
  public ByteBuffer fromByteBuffer(ByteBuffer bytes) {
    return bytes;
  }

  @Override
  public ByteBuffer toByteBuffer(ByteBuffer obj) {
    return obj;
  }

  @Override
  public List<ByteBuffer> toBytesList(List<ByteBuffer> list) {
    return list;
  }

  @Override
  public <V> Map<ByteBuffer, V> toBytesMap(Map<ByteBuffer, V> map) {
    return map;
  }

  @Override
  public <V> Map<ByteBuffer, V> fromBytesMap(Map<ByteBuffer, V> map) {
    return map;
  }
}

@@ -891,24 +891,123 @@
  list;%0A  %7D%0A%0A
+  @Override%0A  public List%3CByteBuffer%3E fromBytesList(List%3CByteBuffer%3E list) %7B%0A    return list;%0A  %7D%0A%0A
   @Override%0A

add fromBytesList to ByteBufferSerializer