org.boon.slumberdb.serialization.JsonSerializerBytes Maven / Gradle / Ivy
package org.boon.slumberdb.serialization;
import org.boon.core.Function;
import org.boon.json.serializers.impl.JsonSimpleSerializerImpl;
import java.nio.charset.StandardCharsets;
/**
* Created by Richard on 4/9/14.
*/
public class JsonSerializerBytes implements Function {
/**
* JSON valueObjectConverter we are using.
*/
protected JsonSimpleSerializerImpl serializer = new JsonSimpleSerializerImpl();
public JsonSerializerBytes(Class type) {
}
@Override
public byte[] apply(T t) {
return serializer.serialize(t).toString().getBytes(StandardCharsets.UTF_8);
}
}