java.lang.Object
org.elasticsearch.xcontent.FilterXContentParser
org.elasticsearch.xcontent.FilterXContentParserWrapper
org.elasticsearch.xcontent.XContentSubParser
org.elasticsearch.xcontent.FlatteningXContentParser
- All Implemented Interfaces:
Closeable
,AutoCloseable
,XContentParser
A subclass of XContentSubParser that provides the functionality to flatten
the field names by prefixing them with the provided parent name.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.XContentParser
XContentParser.NumberType, XContentParser.Token
-
Constructor Summary
ConstructorsConstructorDescriptionFlatteningXContentParser
(XContentParser parser, String parentName) Constructs a FlatteningXContentParser with the given parent name and wraps an existing XContentParser. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the name of the current field being parsed.Methods inherited from class org.elasticsearch.xcontent.XContentSubParser
close, isClosed, nextToken, skipChildren
Methods inherited from class org.elasticsearch.xcontent.FilterXContentParserWrapper
delegate
Methods inherited from class org.elasticsearch.xcontent.FilterXContentParser
allowDuplicateKeys, binaryValue, booleanValue, charBuffer, charBufferOrNull, contentType, currentToken, doubleValue, doubleValue, floatValue, floatValue, getDeprecationHandler, getRestApiVersion, getTokenLocation, getXContentRegistry, hasTextCharacters, intValue, intValue, isBooleanValue, list, listOrderedMap, longValue, longValue, map, map, mapOrdered, mapStrings, namedObject, numberType, numberValue, objectBytes, objectText, shortValue, shortValue, text, textCharacters, textLength, textOffset, textOrNull
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.XContentParser
nextFieldName
-
Constructor Details
-
FlatteningXContentParser
Constructs a FlatteningXContentParser with the given parent name and wraps an existing XContentParser.- Parameters:
parser
- The XContentParser to be wrapped and extended with flattening functionality.parentName
- The parent name to be used as a prefix for immediate children.
-
-
Method Details
-
currentName
Retrieves the name of the current field being parsed. If the current parsing level is 1, the returned field name will be constructed by prepending the parent name to the delegate's currentFieldName, otherwise just delegate.- Specified by:
currentName
in interfaceXContentParser
- Overrides:
currentName
in classFilterXContentParser
- Returns:
- The current field name, potentially modified by prepending the parent name as a prefix.
- Throws:
IOException
- If an I/O error occurs during parsing.
-