All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.rhwayfun.springboot.rocketmq.starter.serialize.json.JsonSerialzation Maven / Gradle / Ivy

package io.github.rhwayfun.springboot.rocketmq.starter.serialize.json;

import com.alibaba.fastjson.JSON;
import io.github.rhwayfun.springboot.rocketmq.starter.serialize.MsgBody;

/**
 * @author rhwayfun
 * @since 0.0.1
 */
public class JsonSerialzation implements MsgBody {

    private final String body;

    public JsonSerialzation(String body) {
        this.body = body;
    }

    @Override
    public  T getBody(Class clazz) {
        if (null == body || "".equals(body.trim())) {
            return null;
        }
        return JSON.parseObject(body, clazz);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy