}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> Serializer<T> getSerializer(Schema schema) {
Serializer serializer = null;
Type type = schema.getType();
if (type.equals(Type.STRING)) {
serializer = CharSequenceSerializer.get();
} else if (type.equals(Type.BOOLEAN)) {
serializer = BooleanSerializer.get();
} else if (type.equals(Type.BYTES)) {
serializer = ByteBufferSerializer.get();
} else if (type.equals(Type.DOUBLE)) {
serializer = DoubleSerializer.get();
} else if (type.equals(Type.FLOAT)) {
serializer = FloatSerializer.get();
} else if (type.equals(Type.INT)) {
serializer = IntegerSerializer.get();
} else if (type.equals(Type.LONG)) {
serializer = LongSerializer.get();
} else if (type.equals(Type.FIXED)) {
Class clazz = TypeUtils.getClass(schema);
serializer = SpecificFixedSerializer.get(clazz);
// serializer = SpecificFixedSerializer.get(schema);
} else if (type.equals(Type.ARRAY)) {
serializer = ListSerializer.get(schema.getElementType());
} else if (type.equals(Type.MAP)) {
serializer = MapSerializer.get(schema.getValueType());
} else if (type.equals(Type.UNION)){
serializer = ByteBufferSerializer.get();
} else if (type.equals(Type.RECORD)){
serializer = BytesArraySerializer.get();
} else {
serializer = null;
}
return serializer;