package com.njzscloud.common.mqtt.support;

import com.njzscloud.common.core.jackson.Jackson;

import java.lang.reflect.Type;

public class MqttMsg {
    private final byte[] msg;

    public MqttMsg(byte[] msg) {
        this.msg = msg;
    }

    public <T> T getMsg(Class<T> clazz) {
        return Jackson.toBean(msg, clazz);
    }

    public <T> T getMsg(Type type) {
        return Jackson.toBean(this.msg, type);
    }
}
