本文整理了Java中org.elasticsearch.common.Strings.substring()
方法的一些代码示例,展示了Strings.substring()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.substring()
方法的具体详情如下:
包路径:org.elasticsearch.common.Strings
类名称:Strings
方法名:substring
[英]Return substring(beginIndex, endIndex) that is impervious to string length.
[中]返回不受字符串长度影响的子字符串(beginIndex,endIndex)。
代码示例来源:origin: org.elasticsearch/elasticsearch
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo) {
boolean fullId = req.paramAsBoolean("full_id", false);
DiscoveryNodes nodes = state.getState().nodes();
Table table = getTableWithHeader(req);
for (DiscoveryNode node : nodes) {
NodeInfo info = nodesInfo.getNodesMap().get(node.getId());
for (Map.Entry<String, String> attrEntry : node.getAttributes().entrySet()) {
table.startRow();
table.addCell(node.getName());
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
table.addCell(node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(attrEntry.getKey());
table.addCell(attrEntry.getValue());
table.endRow();
}
}
return table;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private void buildRow(Table table, boolean fullId, boolean detailed, DiscoveryNodes discoveryNodes, TaskInfo taskInfo) {
table.startRow();
String nodeId = taskInfo.getTaskId().getNodeId();
DiscoveryNode node = discoveryNodes.get(nodeId);
table.addCell(taskInfo.getId());
table.addCell(taskInfo.getAction());
table.addCell(taskInfo.getTaskId().toString());
if (taskInfo.getParentTaskId().isSet()) {
table.addCell(taskInfo.getParentTaskId().toString());
} else {
table.addCell("-");
}
table.addCell(taskInfo.getType());
table.addCell(taskInfo.getStartTime());
table.addCell(FORMATTER.format(Instant.ofEpochMilli(taskInfo.getStartTime())));
table.addCell(taskInfo.getRunningTimeNanos());
table.addCell(TimeValue.timeValueNanos(taskInfo.getRunningTimeNanos()).toString());
// Node information. Note that the node may be null because it has left the cluster between when we got this response and now.
table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4));
table.addCell(node == null ? "-" : node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(node == null ? "-" : node.getName());
table.addCell(node == null ? "-" : node.getVersion().toString());
if (detailed) {
table.addCell(taskInfo.getDescription());
}
table.endRow();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostAddress());
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo) {
boolean fullId = req.paramAsBoolean("full_id", false);
DiscoveryNodes nodes = state.getState().nodes();
Table table = getTableWithHeader(req);
for (DiscoveryNode node : nodes) {
NodeInfo info = nodesInfo.getNodesMap().get(node.getId());
for (Map.Entry<String, String> attrEntry : node.getAttributes().entrySet()) {
table.startRow();
table.addCell(node.getName());
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
table.addCell(node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(attrEntry.getKey());
table.addCell(attrEntry.getValue());
table.endRow();
}
}
return table;
}
}
代码示例来源:origin: apache/servicemix-bundles
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo) {
boolean fullId = req.paramAsBoolean("full_id", false);
DiscoveryNodes nodes = state.getState().nodes();
Table table = getTableWithHeader(req);
for (DiscoveryNode node : nodes) {
NodeInfo info = nodesInfo.getNodesMap().get(node.getId());
for (Map.Entry<String, String> attrEntry : node.getAttributes().entrySet()) {
table.startRow();
table.addCell(node.getName());
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
table.addCell(node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(attrEntry.getKey());
table.addCell(attrEntry.getValue());
table.endRow();
}
}
return table;
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo) {
boolean fullId = req.paramAsBoolean("full_id", false);
DiscoveryNodes nodes = state.getState().nodes();
Table table = getTableWithHeader(req);
for (DiscoveryNode node : nodes) {
NodeInfo info = nodesInfo.getNodesMap().get(node.getId());
for (Map.Entry<String, String> attrEntry : node.getAttributes().entrySet()) {
table.startRow();
table.addCell(node.getName());
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
table.addCell(node.getHostAddress());
if (node.getAddress() instanceof InetSocketTransportAddress) {
table.addCell(((InetSocketTransportAddress) node.getAddress()).address().getPort());
} else {
table.addCell("-");
}
table.addCell(attrEntry.getKey());
table.addCell(attrEntry.getValue());
table.endRow();
}
}
return table;
}
}
代码示例来源:origin: harbby/presto-connectors
table.startRow();
table.addCell(fullId ? node.id() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
代码示例来源:origin: harbby/presto-connectors
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo, NodesStatsResponse nodesStats) {
boolean fullId = req.paramAsBoolean("full_id", false);
DiscoveryNodes nodes = state.getState().nodes();
Table table = getTableWithHeader(req);
for (DiscoveryNode node : nodes) {
NodeInfo info = nodesInfo.getNodesMap().get(node.id());
ImmutableMap<String, String> attrs = node.getAttributes();
for(String att : attrs.keySet()) {
table.startRow();
table.addCell(node.name());
table.addCell(fullId ? node.id() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
table.addCell(node.getHostAddress());
if (node.address() instanceof InetSocketTransportAddress) {
table.addCell(((InetSocketTransportAddress) node.address()).address().getPort());
} else {
table.addCell("-");
}
table.addCell(att);
table.addCell(attrs.containsKey(att) ? attrs.get(att) : null);
table.endRow();
}
}
return table;
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4));
table.addCell(node == null ? "-" : node.getHostAddress());
if (node != null && node.getAddress() instanceof InetSocketTransportAddress) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
private void buildRow(Table table, boolean fullId, boolean detailed, DiscoveryNodes discoveryNodes, TaskInfo taskInfo) {
table.startRow();
String nodeId = taskInfo.getTaskId().getNodeId();
DiscoveryNode node = discoveryNodes.get(nodeId);
table.addCell(taskInfo.getId());
table.addCell(taskInfo.getAction());
table.addCell(taskInfo.getTaskId().toString());
if (taskInfo.getParentTaskId().isSet()) {
table.addCell(taskInfo.getParentTaskId().toString());
} else {
table.addCell("-");
}
table.addCell(taskInfo.getType());
table.addCell(taskInfo.getStartTime());
table.addCell(FORMATTER.format(Instant.ofEpochMilli(taskInfo.getStartTime())));
table.addCell(taskInfo.getRunningTimeNanos());
table.addCell(TimeValue.timeValueNanos(taskInfo.getRunningTimeNanos()).toString());
// Node information. Note that the node may be null because it has left the cluster between when we got this response and now.
table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4));
table.addCell(node == null ? "-" : node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(node == null ? "-" : node.getName());
table.addCell(node == null ? "-" : node.getVersion().toString());
if (detailed) {
table.addCell(taskInfo.getDescription());
}
table.endRow();
}
代码示例来源:origin: apache/servicemix-bundles
private void buildRow(Table table, boolean fullId, boolean detailed, DiscoveryNodes discoveryNodes, TaskInfo taskInfo) {
table.startRow();
String nodeId = taskInfo.getTaskId().getNodeId();
DiscoveryNode node = discoveryNodes.get(nodeId);
table.addCell(taskInfo.getId());
table.addCell(taskInfo.getAction());
table.addCell(taskInfo.getTaskId().toString());
if (taskInfo.getParentTaskId().isSet()) {
table.addCell(taskInfo.getParentTaskId().toString());
} else {
table.addCell("-");
}
table.addCell(taskInfo.getType());
table.addCell(taskInfo.getStartTime());
table.addCell(dateFormat.print(taskInfo.getStartTime()));
table.addCell(taskInfo.getRunningTimeNanos());
table.addCell(TimeValue.timeValueNanos(taskInfo.getRunningTimeNanos()).toString());
// Node information. Note that the node may be null because it has left the cluster between when we got this response and now.
table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4));
table.addCell(node == null ? "-" : node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(node == null ? "-" : node.getName());
table.addCell(node == null ? "-" : node.getVersion().toString());
if (detailed) {
table.addCell(taskInfo.getDescription());
}
table.endRow();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostAddress());
代码示例来源:origin: apache/servicemix-bundles
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostAddress());
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
table.addCell(fullId ? node.getId() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostAddress());
代码示例来源:origin: harbby/presto-connectors
table.addCell(fullId ? node.id() : Strings.substring(node.getId(), 0, 4));
table.addCell(info == null ? null : info.getProcess().getId());
table.addCell(node.getHostName());
内容来源于网络,如有侵权,请联系作者删除!