Java Code Examples for com.alipay.sofa.rpc.common.utils.StringUtils#splitWithCommaOrSemicolon()
The following examples show how to use
com.alipay.sofa.rpc.common.utils.StringUtils#splitWithCommaOrSemicolon() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlackListFileLoader.java From sofa-rpc with Apache License 2.0 | 6 votes |
/** * Override blacklist with override string. * * @param originList Origin black list * @param overrideStr The override string */ static void overrideBlackList(List<String> originList, String overrideStr) { List<String> adds = new ArrayList<String>(); String[] overrideItems = StringUtils.splitWithCommaOrSemicolon(overrideStr); for (String overrideItem : overrideItems) { if (StringUtils.isNotBlank(overrideItem)) { if (overrideItem.startsWith("!") || overrideItem.startsWith("-")) { overrideItem = overrideItem.substring(1); if ("*".equals(overrideItem) || "default".equals(overrideItem)) { originList.clear(); } else { originList.remove(overrideItem); } } else { if (!originList.contains(overrideItem)) { adds.add(overrideItem); } } } } if (adds.size() > 0) { originList.addAll(adds); } }
Example 2
Source File: ModuleFactory.java From sofa-rpc with Apache License 2.0 | 6 votes |
/** * parse module load config * * @param moduleLoadList alias of all config modules * @param moduleName the module name * @return need load */ static boolean needLoad(String moduleLoadList, String moduleName) { String[] activatedModules = StringUtils.splitWithCommaOrSemicolon(moduleLoadList); boolean match = false; for (String activatedModule : activatedModules) { if (StringUtils.ALL.equals(activatedModule)) { match = true; } else if (activatedModule.equals(moduleName)) { match = true; } else if (match && (activatedModule.equals("!" + moduleName) || activatedModule.equals("-" + moduleName))) { match = false; break; } } return match; }
Example 3
Source File: DefaultConsumerBootstrap.java From sofa-rpc with Apache License 2.0 | 6 votes |
/** * Subscribe provider list from direct url * * @param directUrl direct url of consume config * @return Provider group list */ protected List<ProviderGroup> subscribeFromDirectUrl(String directUrl) { List<ProviderGroup> result = new ArrayList<ProviderGroup>(); List<ProviderInfo> tmpProviderInfoList = new ArrayList<ProviderInfo>(); String[] providerStrs = StringUtils.splitWithCommaOrSemicolon(directUrl); for (String providerStr : providerStrs) { ProviderInfo providerInfo = convertToProviderInfo(providerStr); if (providerInfo.getStaticAttr(ProviderInfoAttrs.ATTR_SOURCE) == null) { providerInfo.setStaticAttr(ProviderInfoAttrs.ATTR_SOURCE, "direct"); } tmpProviderInfoList.add(providerInfo); } result.add(new ProviderGroup(RpcConstants.ADDRESS_DIRECT_GROUP, tmpProviderInfoList)); return result; }
Example 4
Source File: DefaultProviderBootstrap.java From sofa-rpc with Apache License 2.0 | 5 votes |
/** * 否则存在method configs 字符串中 * * @param methodConfigs * @param methodName * @return */ private boolean inMethodConfigs(String methodConfigs, String methodName) { String[] excludeMethodCollections = StringUtils.splitWithCommaOrSemicolon(methodConfigs); for (String excludeMethodName : excludeMethodCollections) { boolean exist = StringUtils.equals(excludeMethodName, methodName); if (exist) { return true; } } return false; }