-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Remove 'external values', and replace with swapped out XContentParsers #72203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d8bad73
Remove 'external value' parsing, and replace with swapped out XConten…
romseygeek c109d67
Nested contexts
romseygeek 5b60b73
Merge remote-tracking branch 'origin/master' into mapper/externalvalues
romseygeek 44ef7a5
feedback
romseygeek afa0f20
Merge remote-tracking branch 'origin/master' into mapper/externalvalues
romseygeek ff52018
javadoc style
romseygeek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
246 changes: 246 additions & 0 deletions
246
libs/x-content/src/main/java/org/elasticsearch/common/xcontent/FilterXContentParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.common.xcontent; | ||
|
||
import org.elasticsearch.common.CheckedFunction; | ||
import org.elasticsearch.common.RestApiVersion; | ||
|
||
import java.io.IOException; | ||
import java.nio.CharBuffer; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* Filters an existing XContentParser by using a delegate | ||
*/ | ||
public abstract class FilterXContentParser implements XContentParser { | ||
|
||
protected final XContentParser in; | ||
|
||
protected FilterXContentParser(XContentParser in) { | ||
this.in = in; | ||
} | ||
|
||
@Override | ||
public XContentType contentType() { | ||
return in.contentType(); | ||
} | ||
|
||
@Override | ||
public Token nextToken() throws IOException { | ||
return in.nextToken(); | ||
} | ||
|
||
@Override | ||
public void skipChildren() throws IOException { | ||
in.skipChildren(); | ||
} | ||
|
||
@Override | ||
public Token currentToken() { | ||
return in.currentToken(); | ||
} | ||
|
||
@Override | ||
public String currentName() throws IOException { | ||
return in.currentName(); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> map() throws IOException { | ||
return in.map(); | ||
} | ||
|
||
@Override | ||
public Map<String, Object> mapOrdered() throws IOException { | ||
return in.mapOrdered(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> mapStrings() throws IOException { | ||
return in.mapStrings(); | ||
} | ||
|
||
@Override | ||
public <T> Map<String, T> map( | ||
Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) throws IOException { | ||
return in.map(mapFactory, mapValueParser); | ||
} | ||
|
||
@Override | ||
public List<Object> list() throws IOException { | ||
return in.list(); | ||
} | ||
|
||
@Override | ||
public List<Object> listOrderedMap() throws IOException { | ||
return in.listOrderedMap(); | ||
} | ||
|
||
@Override | ||
public String text() throws IOException { | ||
return in.text(); | ||
} | ||
|
||
@Override | ||
public String textOrNull() throws IOException { | ||
return in.textOrNull(); | ||
} | ||
|
||
@Override | ||
public CharBuffer charBufferOrNull() throws IOException { | ||
return in.charBufferOrNull(); | ||
} | ||
|
||
@Override | ||
public CharBuffer charBuffer() throws IOException { | ||
return in.charBuffer(); | ||
} | ||
|
||
@Override | ||
public Object objectText() throws IOException { | ||
return in.objectText(); | ||
} | ||
|
||
@Override | ||
public Object objectBytes() throws IOException { | ||
return in.objectBytes(); | ||
} | ||
|
||
@Override | ||
public boolean hasTextCharacters() { | ||
return in.hasTextCharacters(); | ||
} | ||
|
||
@Override | ||
public char[] textCharacters() throws IOException { | ||
return in.textCharacters(); | ||
} | ||
|
||
@Override | ||
public int textLength() throws IOException { | ||
return in.textLength(); | ||
} | ||
|
||
@Override | ||
public int textOffset() throws IOException { | ||
return in.textOffset(); | ||
} | ||
|
||
@Override | ||
public Number numberValue() throws IOException { | ||
return in.numberValue(); | ||
} | ||
|
||
@Override | ||
public NumberType numberType() throws IOException { | ||
return in.numberType(); | ||
} | ||
|
||
@Override | ||
public short shortValue(boolean coerce) throws IOException { | ||
return in.shortValue(coerce); | ||
} | ||
|
||
@Override | ||
public int intValue(boolean coerce) throws IOException { | ||
return in.intValue(coerce); | ||
} | ||
|
||
@Override | ||
public long longValue(boolean coerce) throws IOException { | ||
return in.longValue(coerce); | ||
} | ||
|
||
@Override | ||
public float floatValue(boolean coerce) throws IOException { | ||
return in.floatValue(coerce); | ||
} | ||
|
||
@Override | ||
public double doubleValue(boolean coerce) throws IOException { | ||
return in.doubleValue(coerce); | ||
} | ||
|
||
@Override | ||
public short shortValue() throws IOException { | ||
return in.shortValue(); | ||
} | ||
|
||
@Override | ||
public int intValue() throws IOException { | ||
return in.intValue(); | ||
} | ||
|
||
@Override | ||
public long longValue() throws IOException { | ||
return in.longValue(); | ||
} | ||
|
||
@Override | ||
public float floatValue() throws IOException { | ||
return in.floatValue(); | ||
} | ||
|
||
@Override | ||
public double doubleValue() throws IOException { | ||
return in.doubleValue(); | ||
} | ||
|
||
@Override | ||
public boolean isBooleanValue() throws IOException { | ||
return in.isBooleanValue(); | ||
} | ||
|
||
@Override | ||
public boolean booleanValue() throws IOException { | ||
return in.booleanValue(); | ||
} | ||
|
||
@Override | ||
public byte[] binaryValue() throws IOException { | ||
return in.binaryValue(); | ||
} | ||
|
||
@Override | ||
public XContentLocation getTokenLocation() { | ||
return in.getTokenLocation(); | ||
} | ||
|
||
@Override | ||
public <T> T namedObject(Class<T> categoryClass, String name, Object context) throws IOException { | ||
return in.namedObject(categoryClass, name, context); | ||
} | ||
|
||
@Override | ||
public NamedXContentRegistry getXContentRegistry() { | ||
return in.getXContentRegistry(); | ||
} | ||
|
||
@Override | ||
public boolean isClosed() { | ||
return in.isClosed(); | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
in.close(); | ||
} | ||
|
||
@Override | ||
public RestApiVersion getRestApiVersion() { | ||
return in.getRestApiVersion(); | ||
} | ||
|
||
@Override | ||
public DeprecationHandler getDeprecationHandler() { | ||
return in.getDeprecationHandler(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved these checks (where they existed) to the TypeParser so they are now caught at mapping time, instead of when you try and index your first document. There are probably more places where we could do this, but for now I've limited it to just those mappers that were already checking. I've added tests for them as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice clean-up!