// Path: src/main/java/org/easycassandra/persistence/cassandra/Customizable.java
// public interface Customizable {
// 
// 	/**
// 	 * Read the Object and then return the bytebuffer what represents an objects.
// 	 * @param object the object
// 	 * @return a stream of object
// 	 */
// 	ByteBuffer read(Object object);
// 
// 	/**
// 	 * with the bytebuffer write a Object.
// 	 * @param byteBuffer the byteBuffer
// 	 * @return the objet
// 	 */
// 	Object write(ByteBuffer byteBuffer);
// 
// 	/**
// 	 * The default implementation, when uses the CustomData annotation
// 	 * without defines a class which implements this interface,
// 	 * The EasyCassandra gonna to use it.
// 	 * A custom way to serialize and desserialize a object
// 	 * @author osantana
// 	 */
//     class DefaultCustmomizable implements Customizable {
// 
//         public ByteBuffer read(Object object) {
// 
//             try {
//                 isSerializable(object);
//                 ByteArrayOutputStream stream = new ByteArrayOutputStream();
//                 ObjectOutputStream storeObject = new ObjectOutputStream(stream);
//                 storeObject.writeObject(object);
//                 storeObject.flush();
//                 storeObject.close();
// 
//                 return ByteBuffer.wrap(stream.toByteArray());
//             } catch (IOException exception) {
//                 Logger.getLogger(DefaultCustmomizable.class.getName()).severe(
//                         "An error heppend when DefaultCustmomizable try read or "
//                         + "serialize the object "
//                                 + object.getClass().getName() + " "
//                                 + exception.getMessage());
//             }
// 
//             return null;
//         }
// 
//         private void isSerializable(Object object) {
//             if (!(object instanceof Serializable)) {
//                 StringBuilder mensageErro = new StringBuilder();
//                 mensageErro.append("the class ").append(
//                         object.getClass().getName());
//                 mensageErro.append(" should implements java.io.Serializable");
//                 throw new DefaultCustmomizableException(mensageErro.toString());
//             }
// 
//         }
// 
//         public Object write(ByteBuffer byteBuffer) {
// 
//             try {
//                 byte[] result = new byte[byteBuffer.remaining()];
//                 byteBuffer.get(result);
//                 InputStream inputStream = new ByteArrayInputStream(result);
//                 ObjectInputStream objLeitura = new ObjectInputStream(
//                         inputStream);
//                 return objLeitura.readObject();
//             } catch (Exception exception) {
//                 Logger.getLogger(DefaultCustmomizable.class.getName())
//                         .severe("An error heppend when DefaultCustmomizable "
//                                 + "try write and deserialize an object "
//                                 + exception.getMessage());
//             }
//             return null;
//         }
//     }
// }


import java.nio.ByteBuffer;
import org.easycassandra.persistence.cassandra.Customizable;

package org.easycassandra.bean.model;


/**
 * custom to products.
 * @author otaviojava
 */
public class ProductsCustomData implements Customizable {

    @Override
	public ByteBuffer read(Object object) {
		Products products = (Products) object;
		StringBuilder result = new StringBuilder();
		result.append(products.getNome()).append("|");
		result.append(products.getValue()).append("|");
		result.append(products.getCountry());
		return ByteBuffer.wrap(result.toString().getBytes());

	}
    @Override
	public Object write(ByteBuffer byteBuffer) {
	    byte[] result = new byte[byteBuffer.remaining()];

// Path: src/main/java/org/easycassandra/persistence/cassandra/Customizable.java
// public interface Customizable {
// 
// 	/**
// 	 * Read the Object and then return the bytebuffer what represents an objects.
// 	 * @param object the object
// 	 * @return a stream of object
// 	 */
// 	ByteBuffer read(Object object);
// 
// 	/**
// 	 * with the bytebuffer write a Object.
// 	 * @param byteBuffer the byteBuffer
// 	 * @return the objet
// 	 */
// 	Object write(ByteBuffer byteBuffer);
// 
// 	/**
// 	 * The default implementation, when uses the CustomData annotation
// 	 * without defines a class which implements this interface,
// 	 * The EasyCassandra gonna to use it.
// 	 * A custom way to serialize and desserialize a object
// 	 * @author osantana
// 	 */
//     class DefaultCustmomizable implements Customizable {
// 
//         public ByteBuffer read(Object object) {
// 
//             try {
//                 isSerializable(object);
//                 ByteArrayOutputStream stream = new ByteArrayOutputStream();
//                 ObjectOutputStream storeObject = new ObjectOutputStream(stream);
//                 storeObject.writeObject(object);
//                 storeObject.flush();
//                 storeObject.close();
// 
//                 return ByteBuffer.wrap(stream.toByteArray());
//             } catch (IOException exception) {
//                 Logger.getLogger(DefaultCustmomizable.class.getName()).severe(
//                         "An error heppend when DefaultCustmomizable try read or "
//                         + "serialize the object "
//                                 + object.getClass().getName() + " "
//                                 + exception.getMessage());
//             }
// 
//             return null;
//         }
// 
//         private void isSerializable(Object object) {
//             if (!(object instanceof Serializable)) {
//                 StringBuilder mensageErro = new StringBuilder();
//                 mensageErro.append("the class ").append(
//                         object.getClass().getName());
//                 mensageErro.append(" should implements java.io.Serializable");
//                 throw new DefaultCustmomizableException(mensageErro.toString());
//             }
// 
//         }
// 
//         public Object write(ByteBuffer byteBuffer) {
// 
//             try {
//                 byte[] result = new byte[byteBuffer.remaining()];
//                 byteBuffer.get(result);
//                 InputStream inputStream = new ByteArrayInputStream(result);
//                 ObjectInputStream objLeitura = new ObjectInputStream(
//                         inputStream);
//                 return objLeitura.readObject();
//             } catch (Exception exception) {
//                 Logger.getLogger(DefaultCustmomizable.class.getName())
//                         .severe("An error heppend when DefaultCustmomizable "
//                                 + "try write and deserialize an object "
//                                 + exception.getMessage());
//             }
//             return null;
//         }
//     }
// }


// Path: src/test/java/org/easycassandra/bean/model/ProductsCustomData.java
import java.nio.ByteBuffer;
import org.easycassandra.persistence.cassandra.Customizable;

package org.easycassandra.bean.model;


/**
 * custom to products.
 * @author otaviojava
 */
public class ProductsCustomData implements Customizable {

    @Override
	public ByteBuffer read(Object object) {
		Products products = (Products) object;
		StringBuilder result = new StringBuilder();
		result.append(products.getNome()).append("|");
		result.append(products.getValue()).append("|");
		result.append(products.getCountry());
		return ByteBuffer.wrap(result.toString().getBytes());

	}
    @Override
	public Object write(ByteBuffer byteBuffer) {
	    byte[] result = new byte[byteBuffer.remaining()];

        byteBuffer.get(result);
