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

com.alibaba.csp.ahas.sentinel.datasource.parser.WebFlowRuleParser Maven / Gradle / Ivy

There is a newer version: 1.11.7
Show newest version
package com.alibaba.csp.ahas.sentinel.datasource.parser;

import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.csp.sentinel.datasource.acm.DataAcmFormat;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.csp.sentinel.web.adapter.common.rule.WebFlowRule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import java.util.Set;

/**
 * @author guanyu
 * @since 1.10.0
 */
public class WebFlowRuleParser implements Converter> {

    @Override
    public Set convert(String source) {
        if (StringUtil.isBlank(source)) {
            return null;
        }
        String data = new DataAcmFormat(source).getData();
        return JSON.parseObject(data, new TypeReference>() {});
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy