org.elasticsearch.common.settings.Settings.hasValue()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.elasticsearch.common.settings.Settings.hasValue()方法的一些代码示例,展示了Settings.hasValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.hasValue()方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:hasValue

Settings.hasValue介绍

[英]Returns true iff the given key has a value in this settings object
[中]如果给定密钥在此设置对象中有值,则返回true

代码示例

代码示例来源:origin: floragunncom/search-guard

private static Settings checkAndAddNodeName(final Settings settings) {
    if(!settings.hasValue("node.name")) {
      return Settings.builder().put(settings).put("node.name", "auto_node_name_"+System.currentTimeMillis()+"_"+ new Random().nextInt()).build();
    }
    
    return settings;
    
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Returns the string value of the setting for the specified index. The order of search is first
 * in persistent settings the transient settings and finally the default settings.
 * @param setting the name of the setting to get
 * @return String
 */
public String getSetting(String setting) {
  if (persistentSettings.hasValue(setting)) {
    return persistentSettings.get(setting);
  } else if (transientSettings.hasValue(setting)) {
    return transientSettings.get(setting);
  } else if (defaultSettings.hasValue(setting)) {
    return defaultSettings.get(setting);
  } else {
    return null;
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Returns the string value for the specified index and setting.  If the includeDefaults
 * flag was not set or set to false on the GetSettingsRequest, this method will only
 * return a value where the setting was explicitly set on the index.  If the includeDefaults
 * flag was set to true on the GetSettingsRequest, this method will fall back to return the default
 * value if the setting was not explicitly set.
 */
public String getSetting(String index, String setting) {
  Settings settings = indexToSettings.get(index);
  if (setting != null) {
    if (settings != null && settings.hasValue(setting)) {
      return settings.get(setting);
    } else {
      Settings defaultSettings = indexToDefaultSettings.get(index);
      if (defaultSettings != null) {
        return defaultSettings.get(setting);
      } else {
        return null;
      }
    }
  } else {
    return null;
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Returns the string value for the specified index and setting.  If the includeDefaults flag was not set or set to
 * false on the {@link GetIndexRequest}, this method will only return a value where the setting was explicitly set
 * on the index.  If the includeDefaults flag was set to true on the {@link GetIndexRequest}, this method will fall
 * back to return the default value if the setting was not explicitly set.
 */
public String getSetting(String index, String setting) {
  Settings indexSettings = settings.get(index);
  if (setting != null) {
    if (indexSettings != null && indexSettings.hasValue(setting)) {
      return indexSettings.get(setting);
    } else {
      Settings defaultIndexSettings = defaultSettings.get(index);
      if (defaultIndexSettings != null) {
        return defaultIndexSettings.get(setting);
      } else {
        return null;
      }
    }
  } else {
    return null;
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

((onlyDynamic == false && get(key) != null) || isDynamicSetting(key)));
for (String key : toApply.keySet()) {
  boolean isDelete = toApply.hasValue(key) == false;
  if (isDelete && (isValidDelete(key, onlyDynamic) || key.endsWith("*"))) {

代码示例来源:origin: org.elasticsearch/elasticsearch

boolean isWildcard = setting == null && Regex.isSimpleMatchPattern(key);
assert setting != null // we already validated the normalized settings
  || (isWildcard && normalizedSettings.hasValue(key) == false)
  : "unknown setting: " + key + " isWildcard: " + isWildcard + " hasValue: " + normalizedSettings.hasValue(key);
settingsForClosedIndices.copy(key, normalizedSettings);
if (isWildcard || setting.isDynamic()) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Returns the string value of the setting for the specified index. The order of search is first
 * in persistent settings the transient settings and finally the default settings.
 * @param setting the name of the setting to get
 * @return String
 */
public String getSetting(String setting) {
  if (persistentSettings.hasValue(setting)) {
    return persistentSettings.get(setting);
  } else if (transientSettings.hasValue(setting)) {
    return transientSettings.get(setting);
  } else if (defaultSettings.hasValue(setting)) {
    return defaultSettings.get(setting);
  } else {
    return null;
  }
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Returns the string value of the setting for the specified index. The order of search is first
 * in persistent settings the transient settings and finally the default settings.
 * @param setting the name of the setting to get
 * @return String
 */
public String getSetting(String setting) {
  if (persistentSettings.hasValue(setting)) {
    return persistentSettings.get(setting);
  } else if (transientSettings.hasValue(setting)) {
    return transientSettings.get(setting);
  } else if (defaultSettings.hasValue(setting)) {
    return defaultSettings.get(setting);
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Returns the string value for the specified index and setting.  If the includeDefaults flag was not set or set to
 * false on the {@link GetIndexRequest}, this method will only return a value where the setting was explicitly set
 * on the index.  If the includeDefaults flag was set to true on the {@link GetIndexRequest}, this method will fall
 * back to return the default value if the setting was not explicitly set.
 */
public String getSetting(String index, String setting) {
  Settings indexSettings = settings.get(index);
  if (setting != null) {
    if (indexSettings != null && indexSettings.hasValue(setting)) {
      return indexSettings.get(setting);
    } else {
      Settings defaultIndexSettings = defaultSettings.get(index);
      if (defaultIndexSettings != null) {
        return defaultIndexSettings.get(setting);
      } else {
        return null;
      }
    }
  } else {
    return null;
  }
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Returns the string value for the specified index and setting.  If the includeDefaults
 * flag was not set or set to false on the GetSettingsRequest, this method will only
 * return a value where the setting was explicitly set on the index.  If the includeDefaults
 * flag was set to true on the GetSettingsRequest, this method will fall back to return the default
 * value if the setting was not explicitly set.
 */
public String getSetting(String index, String setting) {
  Settings settings = indexToSettings.get(index);
  if (setting != null) {
    if (settings != null && settings.hasValue(setting)) {
      return settings.get(setting);
    } else {
      Settings defaultSettings = indexToDefaultSettings.get(index);
      if (defaultSettings != null) {
        return defaultSettings.get(setting);
      } else {
        return null;
      }
    }
  } else {
    return null;
  }
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Returns the string value for the specified index and setting.  If the includeDefaults flag was not set or set to
 * false on the {@link GetIndexRequest}, this method will only return a value where the setting was explicitly set
 * on the index.  If the includeDefaults flag was set to true on the {@link GetIndexRequest}, this method will fall
 * back to return the default value if the setting was not explicitly set.
 */
public String getSetting(String index, String setting) {
  Settings indexSettings = settings.get(index);
  if (setting != null) {
    if (indexSettings != null && indexSettings.hasValue(setting)) {
      return indexSettings.get(setting);
    } else {
      Settings defaultIndexSettings = defaultSettings.get(index);
      if (defaultIndexSettings != null) {
        return defaultIndexSettings.get(setting);
      } else {
        return null;
      }
    }
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Returns the string value for the specified index and setting.  If the includeDefaults
 * flag was not set or set to false on the GetSettingsRequest, this method will only
 * return a value where the setting was explicitly set on the index.  If the includeDefaults
 * flag was set to true on the GetSettingsRequest, this method will fall back to return the default
 * value if the setting was not explicitly set.
 */
public String getSetting(String index, String setting) {
  Settings settings = indexToSettings.get(index);
  if (setting != null) {
    if (settings != null && settings.hasValue(setting)) {
      return settings.get(setting);
    } else {
      Settings defaultSettings = indexToDefaultSettings.get(index);
      if (defaultSettings != null) {
        return defaultSettings.get(setting);
      } else {
        return null;
      }
    }
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

((onlyDynamic == false && get(key) != null) || isDynamicSetting(key)));
for (String key : toApply.keySet()) {
  boolean isDelete = toApply.hasValue(key) == false;
  if (isDelete && (isValidDelete(key, onlyDynamic) || key.endsWith("*"))) {

代码示例来源:origin: apache/servicemix-bundles

/**
 * Transactional interface to update settings.
 * @see Setting
 * @param <T> the type of the value of the setting
 */
public interface SettingUpdater<T> {
  /**
   * Returns true if this updaters setting has changed with the current update
   * @param current the current settings
   * @param previous the previous setting
   * @return true if this updaters setting has changed with the current update
   */
  boolean hasChanged(Settings current, Settings previous);
  /**
   * Returns the instance value for the current settings. This method is stateless and idempotent.
   * This method will throw an exception if the source of this value is invalid.
   */
  T getValue(Settings current, Settings previous);
  /**
   * Applies the given value to the updater. This methods will actually run the update.
   */
  void apply(T value, Settings current, Settings previous);
  /**
   * Updates this updaters value if it has changed.
   * @return <code>true</code> iff the value has been updated.
   */

代码示例来源:origin: apache/servicemix-bundles

boolean isWildcard = setting == null && Regex.isSimpleMatchPattern(key);
assert setting != null // we already validated the normalized settings
  || (isWildcard && normalizedSettings.hasValue(key) == false)
  : "unknown setting: " + key + " isWildcard: " + isWildcard + " hasValue: " + normalizedSettings.hasValue(key);
settingsForClosedIndices.copy(key, normalizedSettings);
if (isWildcard || setting.isDynamic()) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

boolean isWildcard = setting == null && Regex.isSimpleMatchPattern(key);
assert setting != null // we already validated the normalized settings
  || (isWildcard && normalizedSettings.hasValue(key) == false)
  : "unknown setting: " + key + " isWildcard: " + isWildcard + " hasValue: " + normalizedSettings.hasValue(key);
settingsForClosedIndices.copy(key, normalizedSettings);
if (isWildcard || setting.isDynamic()) {

相关文章