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

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

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

import java.util.Set;

import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.csp.sentinel.datasource.acm.RulesAcmFormat;
import com.alibaba.csp.sentinel.log.RecordLog;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

/**
 * @author Eric Zhao
 * @since 1.3.0
 */
public class GatewayFlowRuleParser implements Converter> {

    @Override
    public Set convert(String source) {
        if (StringUtil.isBlank(source)) {
            return null;
        }
        String data = new RulesAcmFormat(source).getData();
        RecordLog.info("[GatewayFlowRuleParser] Get data: " + data);
        return JSON.parseObject(data, new TypeReference>() {});
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy