com.fasterxml.jackson.core.base.GeneratorBase Java Examples

The following examples show how to use com.fasterxml.jackson.core.base.GeneratorBase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonXContentGenerator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public JsonXContentGenerator(JsonGenerator jsonGenerator, OutputStream os, String... filters) {
    if (jsonGenerator instanceof GeneratorBase) {
        this.base = (GeneratorBase) jsonGenerator;
    } else {
        this.base = null;
    }

    if (CollectionUtils.isEmpty(filters)) {
        this.generator = jsonGenerator;
        this.filter = null;
    } else {
        this.filter = new FilteringGeneratorDelegate(jsonGenerator, new FilterPathBasedFilter(filters), true, true);
        this.generator = this.filter;
    }

    this.os = os;
}
 
Example #2
Source File: CsvXContentGenerator.java    From elasticsearch-rest-command with The Unlicense 5 votes vote down vote up
public CsvXContentGenerator(CsvGenerator generator) {
    this.generator = generator;
    if (generator instanceof GeneratorBase) {
        base = (GeneratorBase) generator;
    } else {
        base = null;
    }

}
 
Example #3
Source File: JsonXContentGenerator.java    From crate with Apache License 2.0 5 votes vote down vote up
public JsonXContentGenerator(JsonGenerator jsonGenerator, OutputStream os, Set<String> includes, Set<String> excludes) {
    Objects.requireNonNull(includes, "Including filters must not be null");
    Objects.requireNonNull(excludes, "Excluding filters must not be null");
    this.os = os;
    if (jsonGenerator instanceof GeneratorBase) {
        this.base = (GeneratorBase) jsonGenerator;
    } else {
        this.base = null;
    }

    JsonGenerator generator = jsonGenerator;

    boolean hasExcludes = excludes.isEmpty() == false;
    if (hasExcludes) {
        generator = new FilteringGeneratorDelegate(generator, new FilterPathBasedFilter(excludes, false), true, true);
    }

    boolean hasIncludes = includes.isEmpty() == false;
    if (hasIncludes) {
        generator = new FilteringGeneratorDelegate(generator, new FilterPathBasedFilter(includes, true), true, true);
    }

    if (hasExcludes || hasIncludes) {
        this.filter = (FilteringGeneratorDelegate) generator;
    } else {
        this.filter = null;
    }
    this.generator = generator;
}