package com.unis.framework.mybatis.core.type;

import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.fasterxml.jackson.core.type.TypeReference;
import com.unis.framework.common.util.json.JsonUtils;

import java.util.List;

public class JsonStringListTypeHandler  extends AbstractJsonTypeHandler<Object> {

    private static final TypeReference<List<String>> TYPE_REFERENCE = new TypeReference<List<String>>(){};
    private static final String COMMA = ",";
    @Override
    protected Object parse(String json) {
        return JsonUtils.parseObject(json, TYPE_REFERENCE);
    }

    @Override
    protected String toJson(Object obj) {
        return JsonUtils.toJsonString(obj);
    }

}
