Can anyone help me with this?

On Thu, Nov 24, 2016 at 10:29 AM, Check Peck <[email protected]>
wrote:

> I am working with Avro and I have a GenericRecord. I want to extract
> clientId and deviceName from it. In the Avro Schema, clientId is integer
> and deviceName is String. My question is - what is the recommended way to
> retrieve a typed value, as opposed to an Object or extracting everything as
> a String and then converting it back to original data type?
>
> In the below code, payload is GenericRecord. This is what I am doing
> right now, extracting everything as a String. But how can I just get typed
> value instead. Is there any way? I mean whatever the data type is there in
> the avro schema, I want to extract that only.
>
> String id = String.valueOf(payload.get("clientId"));String name = 
> String.valueOf(payload.get("deviceName"));
>
>

Reply via email to