Minor refactoring and indentation fixes
This commit is contained in:
parent
a0d8d656fc
commit
db4c6c96a3
|
@ -83,7 +83,7 @@ public final class XContentBuilder implements BytesStream, Releasable {
|
|||
return new XContentBuilder(xContent, new BytesStreamOutput(), filters);
|
||||
}
|
||||
|
||||
public static XContentBuilder builder(XContent xContent, boolean inclusive, String[] filters) throws IOException {
|
||||
public static XContentBuilder builder(XContent xContent, String[] filters, boolean inclusive) throws IOException {
|
||||
return new XContentBuilder(xContent, new BytesStreamOutput(), inclusive, filters);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ public class SmileXContent implements XContent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public XContentGenerator createGenerator(OutputStream os, String[] filters, boolean inclusiveFilters) throws IOException {
|
||||
return new SmileXContentGenerator(smileFactory.createGenerator(os, JsonEncoding.UTF8), os, inclusiveFilters, filters);
|
||||
public XContentGenerator createGenerator(OutputStream os, String[] filters, boolean inclusive) throws IOException {
|
||||
return new SmileXContentGenerator(smileFactory.createGenerator(os, JsonEncoding.UTF8), os, inclusive, filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -92,18 +92,11 @@ public class FilterPathBasedFilter extends TokenFilter {
|
|||
@Override
|
||||
public TokenFilter includeProperty(String name) {
|
||||
TokenFilter filter = evaluate(name, filters);
|
||||
if (inclusive) {
|
||||
if (filter == MATCHING) {
|
||||
return TokenFilter.INCLUDE_ALL;
|
||||
} else if (filter == NO_MATCHING) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (filter == MATCHING) {
|
||||
return null;
|
||||
} else if (filter == NO_MATCHING) {
|
||||
return TokenFilter.INCLUDE_ALL;
|
||||
return inclusive ? TokenFilter.INCLUDE_ALL : null;
|
||||
}
|
||||
if (filter == NO_MATCHING) {
|
||||
return inclusive ? null : TokenFilter.INCLUDE_ALL;
|
||||
}
|
||||
return filter;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public abstract class AbstractFilteringJsonGeneratorTestCase extends ESTestCase
|
|||
}
|
||||
|
||||
private XContentBuilder newXContentBuilder(boolean inclusive, String... filters) throws IOException {
|
||||
return XContentBuilder.builder(getXContentType().xContent(), inclusive, filters);
|
||||
return XContentBuilder.builder(getXContentType().xContent(), filters, inclusive);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -523,7 +523,6 @@ public abstract class AbstractFilteringJsonGeneratorTestCase extends ESTestCase
|
|||
.endObject()
|
||||
.endObject();
|
||||
|
||||
|
||||
assertXContentBuilder(expected, sample(false, "tags"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue