/** * Serialize a field using the Codec for the value itself * * @param value * @return */ public <T> ByteBuffer serialize(T value) { final CodecRegistry codecRegistry = getCodecRegistry(); final TypeCodec<T> typeCodec = codecRegistry.codecFor(value); return typeCodec.serialize((T) value, protocolVersion); }
/** * Serialize a field using the data type passed. * * @param dataType * @param value * @return */ @SuppressWarnings("unchecked") public <T> ByteBuffer serialize(DataType dataType, Object value) { final CodecRegistry codecRegistry = getCodecRegistry(); final TypeCodec<T> typeCodec = codecRegistry.codecFor(dataType); return typeCodec.serialize((T) value, protocolVersion); }