com.alibaba.csp.ahas.sentinel.datasource.parser.ApplicationClusterInfoParser Maven / Gradle / Ivy
package com.alibaba.csp.ahas.sentinel.datasource.parser;
import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.csp.sentinel.datasource.acm.RulesAcmFormat;
import com.alibaba.csp.sentinel.machine.MachineGroupEntity;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson.JSON;
public class ApplicationClusterInfoParser implements Converter {
@Override
public MachineGroupEntity convert(String source) {
if (StringUtil.isBlank(source)) {
return null;
}
String data = new RulesAcmFormat(source).getData();
if (StringUtil.isBlank(data)) {
return null;
}
return JSON.parseObject(data, MachineGroupEntity.class);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy