Refine search
private void setTableName(String tableName) { checkArgument(!isNullOrEmpty(tableName), "tableName is null or empty string"); this.tableName = tableName; }
/** * Get logic schema. * * @param schemaName schema name * @return sharding schema */ public LogicSchema getLogicSchema(final String schemaName) { return Strings.isNullOrEmpty(schemaName) ? null : logicSchemas.get(schemaName); }
private String assembleInstanceKey(String appId, String cluster, String ip, String datacenter) { List<String> keyParts = Lists.newArrayList(appId, cluster, ip); if (!Strings.isNullOrEmpty(datacenter)) { keyParts.add(datacenter); } return STRING_JOINER.join(keyParts); }
void addMainClass(String pluginKey, @Nullable String mainClass) { if (!Strings.isNullOrEmpty(mainClass)) { mainClassesByPluginKey.put(pluginKey, mainClass); } }
private Map<String, ApolloConfigNotification> filterNotifications(String appId, List<ApolloConfigNotification> notifications) { Map<String, ApolloConfigNotification> filteredNotifications = Maps.newHashMap(); for (ApolloConfigNotification notification : notifications) { if (Strings.isNullOrEmpty(notification.getNamespaceName())) { continue; } //strip out .properties suffix String originalNamespace = namespaceUtil.filterNamespaceName(notification.getNamespaceName()); notification.setNamespaceName(originalNamespace); //fix the character case issue, such as FX.apollo <-> fx.apollo String normalizedNamespace = namespaceUtil.normalizeNamespace(appId, originalNamespace); // in case client side namespace name has character case issue and has difference notification ids // such as FX.apollo = 1 but fx.apollo = 2, we should let FX.apollo have the chance to update its notification id // which means we should record FX.apollo = 1 here and ignore fx.apollo = 2 if (filteredNotifications.containsKey(normalizedNamespace) && filteredNotifications.get(normalizedNamespace).getNotificationId() < notification.getNotificationId()) { continue; } filteredNotifications.put(normalizedNamespace, notification); } return filteredNotifications; }
private static String transition(Map<String, Object> properties) { String param = (String) properties.get(TRANSITION_PARAMETER); checkArgument(!isNullOrEmpty(param), "Missing parameter : 'transition'"); return param; }
public List<AppNamespace> findByAppIdAndNamespaces(String appId, Set<String> namespaceNames) { Preconditions.checkArgument(!Strings.isNullOrEmpty(appId), "appId must not be null"); if (namespaceNames == null || namespaceNames.isEmpty()) { return Collections.emptyList(); } List<AppNamespace> result = Lists.newArrayList(); for (String namespaceName : namespaceNames) { AppNamespace appNamespace = appNamespaceCache.get(STRING_JOINER.join(appId, namespaceName)); if (appNamespace != null) { result.add(appNamespace); } } return result; }
private DefaultHeaders setValue(String name, @Nullable String value) { checkArgument(!isNullOrEmpty(name)); if (value == null) { keyValues.remove(name); } else { keyValues.put(name, value); } return this; }
/** * Get logic schema. * * @param schemaName schema name * @return sharding schema */ public LogicSchema getLogicSchema(final String schemaName) { return Strings.isNullOrEmpty(schemaName) ? null : logicSchemas.get(schemaName); }
private String assembleKey(String appId, String cluster, String namespace, String dataCenter) { List<String> keyParts = Lists.newArrayList(appId, cluster, namespace); if (!Strings.isNullOrEmpty(dataCenter)) { keyParts.add(dataCenter); } return keyParts.stream().collect(Collectors.joining(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR)); }
private Map<String, Object> getQueryParameters(final UriInfo info, final String[] params) { final Map<String, Object> result = new HashMap<>(); for (String each : params) { if (!Strings.isNullOrEmpty(info.getQueryParameters().getFirst(each))) { result.put(each, info.getQueryParameters().getFirst(each)); } } return result; } }
private void updateRemoteNotifications(List<ApolloConfigNotification> deltaNotifications) { for (ApolloConfigNotification notification : deltaNotifications) { if (Strings.isNullOrEmpty(notification.getNamespaceName())) { continue; } if (notification.getMessages() == null || notification.getMessages().isEmpty()) { continue; } ApolloNotificationMessages localRemoteMessages = m_remoteNotificationMessages.get(notification.getNamespaceName()); if (localRemoteMessages == null) { localRemoteMessages = new ApolloNotificationMessages(); m_remoteNotificationMessages.put(notification.getNamespaceName(), localRemoteMessages); } localRemoteMessages.mergeFrom(notification.getMessages()); } }
private static String verifySeverityParameter(Map<String, Object> properties) { String param = (String) properties.get(SEVERITY_PARAMETER); checkArgument(!isNullOrEmpty(param), "Missing parameter : '%s'", SEVERITY_PARAMETER); return param; } }
private static List<IssuePattern> loadPatterns(String propertyKey, Configuration settings) { List<IssuePattern> patterns = new ArrayList<>(); String patternConf = settings.get(propertyKey).orElse(""); for (String id : Splitter.on(",").omitEmptyStrings().split(patternConf)) { String propPrefix = propertyKey + "." + id + "."; String componentPathPattern = settings.get(propPrefix + RESOURCE_KEY).orElse(null); checkArgument(!isNullOrEmpty(componentPathPattern), format("File path pattern cannot be empty. Please check '%s' settings", propertyKey)); String ruleKeyPattern = settings.get(propPrefix + RULE_KEY).orElse(null); checkArgument(!isNullOrEmpty(ruleKeyPattern), format("Rule key pattern cannot be empty. Please check '%s' settings", propertyKey)); patterns.add(new IssuePattern(componentPathPattern, ruleKeyPattern)); } return patterns; }
public MongoConnectorFactory(String name) { checkArgument(!isNullOrEmpty(name), "name is null or empty"); this.name = name; }
public boolean stringIsSet(String key) { return !isNullOrEmpty(strings.get(key)); }
String assembleCacheKey(ConfigFileOutputFormat outputFormat, String appId, String clusterName, String namespace, String dataCenter) { List<String> keyParts = Lists.newArrayList(outputFormat.getValue(), appId, clusterName, namespace); if (!Strings.isNullOrEmpty(dataCenter)) { keyParts.add(dataCenter); } return STRING_JOINER.join(keyParts); }
@VisibleForTesting static Map<String, String> parseHeaders(String headerString) { if (isNullOrEmpty(headerString)) { return Collections.emptyMap(); } final Map<String, String> headers = Maps.newHashMap(); for (String headerPart : headerString.trim().split(",")) { final String[] parts = headerPart.trim().split(":"); if (parts.length == 2) { headers.put(parts[0].trim(), parts[1].trim()); } } return headers; }
private static void checkActionExtension(@Nullable String actionExtension) { if (isNullOrEmpty(actionExtension)) { return; } checkArgument(SUPPORTED_MEDIA_TYPES_BY_URL_SUFFIX.get(actionExtension.toLowerCase(Locale.ENGLISH)) != null, "Unknown action extension: %s", actionExtension); }
private void setType(String type) { checkArgument(!isNullOrEmpty(type), "type is null or empty string"); this.type = type; }