本文整理了Java中org.elasticsearch.common.settings.Settings.toString()
方法的一些代码示例,展示了Settings.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.toString()
方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:toString
暂无
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns the setting value associated with the setting key.
*
* @param setting The setting key
* @return The setting value, {@code null} if it does not exists.
*/
public String get(String setting) {
return toString(settings.get(setting));
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns the setting value associated with the setting key. If it does not exists,
* returns the default value provided.
*/
String get(String setting, String defaultValue, boolean isList) {
Object value = settings.get(setting);
if (value != null) {
if (value instanceof List) {
if (isList == false) {
throw new IllegalArgumentException(
"Found list type value for setting [" + setting + "] but but did not expect a list for it."
);
}
} else if (isList) {
throw new IllegalArgumentException(
"Expected list type value for setting [" + setting + "] but found [" + value.getClass() + ']'
);
}
return toString(value);
} else {
return defaultValue;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException {
// pull settings to exclude secure settings in size()
Set<Map.Entry<String, Object>> entries = settings.settings.entrySet();
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
out.writeVInt(entries.size());
for (Map.Entry<String, Object> entry : entries) {
out.writeString(entry.getKey());
out.writeGenericValue(entry.getValue());
}
} else {
int size = entries.stream().mapToInt(e -> e.getValue() instanceof List ? ((List)e.getValue()).size() : 1).sum();
out.writeVInt(size);
for (Map.Entry<String, Object> entry : entries) {
if (entry.getValue() instanceof List) {
int idx = 0;
for (String value : (List<String>)entry.getValue()) {
out.writeString(entry.getKey() + "." + idx++);
out.writeOptionalString(value);
}
} else {
out.writeString(entry.getKey());
out.writeOptionalString(toString(entry.getValue()));
}
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Returns the setting value associated with the setting key.
*
* @param setting The setting key
* @return The setting value, {@code null} if it does not exists.
*/
public String get(String setting) {
return toString(settings.get(setting));
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Returns the setting value associated with the setting key.
*
* @param setting The setting key
* @return The setting value, {@code null} if it does not exists.
*/
public String get(String setting) {
return toString(settings.get(setting));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Returns the setting value associated with the setting key. If it does not exists,
* returns the default value provided.
*/
String get(String setting, String defaultValue, boolean isList) {
Object value = settings.get(setting);
if (value != null) {
if (value instanceof List) {
if (isList == false) {
throw new IllegalArgumentException(
"Found list type value for setting [" + setting + "] but but did not expect a list for it."
);
}
} else if (isList) {
throw new IllegalArgumentException(
"Expected list type value for setting [" + setting + "] but found [" + value.getClass() + ']'
);
}
return toString(value);
} else {
return defaultValue;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException {
// pull settings to exclude secure settings in size()
Set<Map.Entry<String, Object>> entries = settings.settings.entrySet();
if (out.getVersion().onOrAfter(Version.V_6_1_0)) {
out.writeVInt(entries.size());
for (Map.Entry<String, Object> entry : entries) {
out.writeString(entry.getKey());
out.writeGenericValue(entry.getValue());
}
} else {
int size = entries.stream().mapToInt(e -> e.getValue() instanceof List ? ((List)e.getValue()).size() : 1).sum();
out.writeVInt(size);
for (Map.Entry<String, Object> entry : entries) {
if (entry.getValue() instanceof List) {
int idx = 0;
for (String value : (List<String>)entry.getValue()) {
out.writeString(entry.getKey() + "." + idx++);
out.writeOptionalString(value);
}
} else {
out.writeString(entry.getKey());
out.writeOptionalString(toString(entry.getValue()));
}
}
}
}
代码示例来源:origin: apache/jena
.put(NUM_OF_REPLICAS_PARAM, esSettings.getReplicas())
.build();
LOGGER.debug("Index with name " + indexName + " does not exist yet. Creating one with settings: " + indexSettings.toString());
client.admin().indices().prepareCreate(indexName).setSettings(indexSettings).get();
内容来源于网络,如有侵权,请联系作者删除!