Module org.elasticsearch.xcontent
Class AbstractXContentParser
java.lang.Object
org.elasticsearch.xcontent.support.AbstractXContentParser
- All Implemented Interfaces:
Closeable,AutoCloseable,XContentParser
- Direct Known Subclasses:
MapXContentParser
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.XContentParser
XContentParser.NumberType, XContentParser.Token -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler) AbstractXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, RestApiVersion restApiVersion) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected abstract booleanprotected abstract doubleprotected abstract floatprotected abstract intprotected abstract longprotected abstract shortdoubledoubledoubleValue(boolean coerce) floatfloatfloatValue(boolean coerce) The callback to notify when parsing encounters a deprecated field.The registry used to resolveXContentParser.namedObject(Class, String, Object).intintValue()intintValue(boolean coerce) booleanabstract booleanisClosed()list()longlonglongValue(boolean coerce) map()map(Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) Returns an instance ofMapholding parsed map.<T> TnamedObject(Class<T> categoryClass, String name, Object context) Parse an object by name.static ObjectshortshortshortValue(boolean coerce) final StringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.XContentParser
allowDuplicateKeys, binaryValue, charBuffer, contentType, currentName, currentToken, getTokenLocation, hasTextCharacters, nextFieldName, nextToken, numberType, numberValue, objectBytes, objectText, skipChildren, text, textCharacters, textLength, textOffset
-
Field Details
-
DEFAULT_NUMBER_COERCE_POLICY
public static final boolean DEFAULT_NUMBER_COERCE_POLICY- See Also:
-
-
Constructor Details
-
AbstractXContentParser
public AbstractXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler, RestApiVersion restApiVersion) -
AbstractXContentParser
public AbstractXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler)
-
-
Method Details
-
isBooleanValue
- Specified by:
isBooleanValuein interfaceXContentParser- Returns:
- true iff the current value is either boolean (
trueorfalse) or one of "false", "true". - Throws:
IOException
-
booleanValue
- Specified by:
booleanValuein interfaceXContentParser- Throws:
IOException
-
doBooleanValue
- Throws:
IOException
-
shortValue
- Specified by:
shortValuein interfaceXContentParser- Throws:
IOException
-
shortValue
- Specified by:
shortValuein interfaceXContentParser- Throws:
IOException
-
doShortValue
- Throws:
IOException
-
intValue
- Specified by:
intValuein interfaceXContentParser- Throws:
IOException
-
intValue
- Specified by:
intValuein interfaceXContentParser- Throws:
IOException
-
doIntValue
- Throws:
IOException
-
longValue
- Specified by:
longValuein interfaceXContentParser- Throws:
IOException
-
longValue
- Specified by:
longValuein interfaceXContentParser- Throws:
IOException
-
doLongValue
- Throws:
IOException
-
floatValue
- Specified by:
floatValuein interfaceXContentParser- Throws:
IOException
-
floatValue
- Specified by:
floatValuein interfaceXContentParser- Throws:
IOException
-
doFloatValue
- Throws:
IOException
-
doubleValue
- Specified by:
doubleValuein interfaceXContentParser- Throws:
IOException
-
doubleValue
- Specified by:
doubleValuein interfaceXContentParser- Throws:
IOException
-
doDoubleValue
- Throws:
IOException
-
textOrNull
- Specified by:
textOrNullin interfaceXContentParser- Throws:
IOException
-
charBufferOrNull
- Specified by:
charBufferOrNullin interfaceXContentParser- Throws:
IOException
-
map
- Specified by:
mapin interfaceXContentParser- Throws:
IOException
-
mapOrdered
- Specified by:
mapOrderedin interfaceXContentParser- Throws:
IOException
-
mapStrings
- Specified by:
mapStringsin interfaceXContentParser- Throws:
IOException
-
map
public <T> Map<String,T> map(Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, throws IOExceptionT, IOException> mapValueParser) Description copied from interface:XContentParserReturns an instance ofMapholding parsed map. Serves as a replacement for the "map", "mapOrdered" and "mapStrings" methods above.- Specified by:
mapin interfaceXContentParser- Type Parameters:
T- map value type- Parameters:
mapFactory- factory for creating newMapobjectsmapValueParser- parser for parsing a single map value- Returns:
Mapobject- Throws:
IOException
-
list
- Specified by:
listin interfaceXContentParser- Throws:
IOException
-
listOrderedMap
- Specified by:
listOrderedMapin interfaceXContentParser- Throws:
IOException
-
readValue
public static Object readValue(XContentParser parser, Supplier<Map<String, Object>> mapFactory) throws IOException- Throws:
IOException
-
namedObject
Description copied from interface:XContentParserParse an object by name.- Specified by:
namedObjectin interfaceXContentParser- Throws:
IOException
-
getXContentRegistry
Description copied from interface:XContentParserThe registry used to resolveXContentParser.namedObject(Class, String, Object). Use this when building a sub-parser from this parser.- Specified by:
getXContentRegistryin interfaceXContentParser
-
isClosed
public abstract boolean isClosed()- Specified by:
isClosedin interfaceXContentParser
-
getRestApiVersion
- Specified by:
getRestApiVersionin interfaceXContentParser
-
getDeprecationHandler
Description copied from interface:XContentParserThe callback to notify when parsing encounters a deprecated field.- Specified by:
getDeprecationHandlerin interfaceXContentParser
-