package com.m2pool.lease.netty.parser;


import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.m2pool.lease.netty.message.ClientMessage;
import com.m2pool.lease.netty.message.GpuMessage;

import java.util.HashMap;

public class GpuMessageMapParser implements MessageParser<ClientMessage<HashMap<Integer, GpuMessage>>> {
    @Override
    public ClientMessage<HashMap<Integer, GpuMessage>> parse(ObjectMapper objectMapper, String jsonStr) throws Exception {
        return objectMapper.readValue(jsonStr, getTypeReference());
    }

    @Override
    public TypeReference<ClientMessage<HashMap<Integer, GpuMessage>>> getTypeReference() {
        return new TypeReference<ClientMessage<HashMap<Integer, GpuMessage>>>() {};
    }
}
