protected P upConvertPayload ( GenericRecord inputRecord ) throws DataConversionException { try { Schema payloadSchema = getPayloadSchema ( inputRecord ) ; // Set writer schema latestPayloadReader . setSchema ( payloadSchema ) ; byte [ ] payloadBytes = getPayloadBytes ( inputRecord ) ; Decoder decoder = DecoderFactory . get ( ) . binaryDecoder ( payloadBytes , null ) ; // 'latestPayloadReader.read' will convert the record from 'payloadSchema' to the latest payload schema return latestPayloadReader . read ( null , decoder ) ; } catch ( Exception e ) { throw new DataConversionException ( e ) ; } }
Convert the payload in the input record to a deserialized object with the latest schema