package com.zhiqiyun.open.core.typeHandler;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.zhiqiyun.open.core.models.sentiment.UrlPatterns;

import java.util.List;

public class UrlPatternTypeHandler extends AbstractJsonTypeHandler<List<UrlPatterns>> {
    protected List<UrlPatterns> parse(String json) {
        return JSON.parseArray(json, UrlPatterns.class);
    }

    protected String toJson(List<UrlPatterns> list) {
        return JSON.toJSONString(list, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty, SerializerFeature.WriteNullStringAsEmpty);
    }
}

