本文整理了Java中org.elasticsearch.common.xcontent.XContentBuilder.generator()
方法的一些代码示例,展示了XContentBuilder.generator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XContentBuilder.generator()
方法的具体详情如下:
包路径:org.elasticsearch.common.xcontent.XContentBuilder
类名称:XContentBuilder
方法名:generator
[英]XContentGenerator used to build the XContent object
[中]用于构建XContent对象的XContentGenerator
代码示例来源:origin: org.elasticsearch/elasticsearch
boolean assertBuilderClosed(XContentBuilder xContentBuilder) {
assert xContentBuilder.generator().isClosed() : "callers should ensure the XContentBuilder is closed themselves";
return true;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
*
* @param parser the parser for the XContent that contains the serialized GetPipelineResponse.
* @return an instance of GetPipelineResponse read from the parser
* @throws IOException If the parsing fails
*/
public static GetPipelineResponse fromXContent(XContentParser parser) throws IOException {
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation);
List<PipelineConfiguration> pipelines = new ArrayList<>();
while(parser.nextToken().equals(Token.FIELD_NAME)) {
String pipelineId = parser.currentName();
parser.nextToken();
XContentBuilder contentBuilder = XContentBuilder.builder(parser.contentType().xContent());
contentBuilder.generator().copyCurrentStructure(parser);
PipelineConfiguration pipeline =
new PipelineConfiguration(
pipelineId, BytesReference.bytes(contentBuilder), contentBuilder.contentType()
);
pipelines.add(pipeline);
}
ensureExpectedToken(XContentParser.Token.END_OBJECT, parser.currentToken(), parser::getTokenLocation);
return new GetPipelineResponse(pipelines);
}
代码示例来源:origin: apache/servicemix-bundles
boolean assertBuilderClosed(XContentBuilder xContentBuilder) {
assert xContentBuilder.generator().isClosed() : "callers should ensure the XContentBuilder is closed themselves";
return true;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
boolean assertBuilderClosed(XContentBuilder xContentBuilder) {
assert xContentBuilder.generator().isClosed() : "callers should ensure the XContentBuilder is closed themselves";
return true;
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
boolean assertBuilderClosed(XContentBuilder xContentBuilder) {
assert xContentBuilder.generator().isClosed() : "callers should ensure the XContentBuilder is closed themselves";
return true;
}
}
代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client
private static BytesReference parseBytes(XContentParser parser) throws IOException {
XContentBuilder contentBuilder = JsonXContent.contentBuilder();
contentBuilder.generator().copyCurrentStructure(parser);
return BytesReference.bytes(contentBuilder);
}
代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client
private static BytesReference parseBytes(XContentParser parser) throws IOException {
XContentBuilder contentBuilder = JsonXContent.contentBuilder();
contentBuilder.generator().copyCurrentStructure(parser);
return BytesReference.bytes(contentBuilder);
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
/**
* Create a new {@link XContentParser}.
*/
protected final XContentParser createParser(XContentBuilder builder) throws IOException {
return builder.generator().contentType().xContent().createParser(xContentRegistry(), builder.bytes());
}
代码示例来源:origin: org.codelibs.elasticsearch.module/lang-painless
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
{
if (index != null) {
builder.field(INDEX_FIELD.getPreferredName(), index);
}
if (document != null) {
builder.field(DOCUMENT_FIELD.getPreferredName());
try (XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY,
LoggingDeprecationHandler.INSTANCE, document, xContentType)) {
builder.generator().copyCurrentStructure(parser);
}
}
if (query != null) {
builder.field(QUERY_FIELD.getPreferredName(), query);
}
}
builder.endObject();
return builder;
}
代码示例来源:origin: apache/servicemix-bundles
/**
*
* @param parser the parser for the XContent that contains the serialized GetPipelineResponse.
* @return an instance of GetPipelineResponse read from the parser
* @throws IOException If the parsing fails
*/
public static GetPipelineResponse fromXContent(XContentParser parser) throws IOException {
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation);
List<PipelineConfiguration> pipelines = new ArrayList<>();
while(parser.nextToken().equals(Token.FIELD_NAME)) {
String pipelineId = parser.currentName();
parser.nextToken();
XContentBuilder contentBuilder = XContentBuilder.builder(parser.contentType().xContent());
contentBuilder.generator().copyCurrentStructure(parser);
PipelineConfiguration pipeline =
new PipelineConfiguration(
pipelineId, BytesReference.bytes(contentBuilder), contentBuilder.contentType()
);
pipelines.add(pipeline);
}
ensureExpectedToken(XContentParser.Token.END_OBJECT, parser.currentToken(), parser::getTokenLocation);
return new GetPipelineResponse(pipelines);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
*
* @param parser the parser for the XContent that contains the serialized GetPipelineResponse.
* @return an instance of GetPipelineResponse read from the parser
* @throws IOException If the parsing fails
*/
public static GetPipelineResponse fromXContent(XContentParser parser) throws IOException {
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser::getTokenLocation);
List<PipelineConfiguration> pipelines = new ArrayList<>();
while(parser.nextToken().equals(Token.FIELD_NAME)) {
String pipelineId = parser.currentName();
parser.nextToken();
XContentBuilder contentBuilder = XContentBuilder.builder(parser.contentType().xContent());
contentBuilder.generator().copyCurrentStructure(parser);
PipelineConfiguration pipeline =
new PipelineConfiguration(
pipelineId, BytesReference.bytes(contentBuilder), contentBuilder.contentType()
);
pipelines.add(pipeline);
}
ensureExpectedToken(XContentParser.Token.END_OBJECT, parser.currentToken(), parser::getTokenLocation);
return new GetPipelineResponse(pipelines);
}
代码示例来源:origin: org.elasticsearch.plugin/percolator-client
LoggingDeprecationHandler.INSTANCE, document)) {
parser.nextToken();
builder.generator().copyCurrentStructure(parser);
代码示例来源:origin: org.codelibs.elasticsearch.module/percolator
LoggingDeprecationHandler.INSTANCE, document)) {
parser.nextToken();
builder.generator().copyCurrentStructure(parser);
内容来源于网络,如有侵权,请联系作者删除!