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 TypeMethodDescriptionboolean
protected abstract boolean
protected abstract double
protected abstract float
protected abstract int
protected abstract long
protected abstract short
double
double
doubleValue
(boolean coerce) float
float
floatValue
(boolean coerce) The callback to notify when parsing encounters a deprecated field.The registry used to resolveXContentParser.namedObject(Class, String, Object)
.int
intValue()
int
intValue
(boolean coerce) boolean
abstract boolean
isClosed()
list()
long
long
longValue
(boolean coerce) map()
map
(Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) Returns an instance ofMap
holding parsed map.<T> T
namedObject
(Class<T> categoryClass, String name, Object context) Parse an object by name.static Object
short
short
shortValue
(boolean coerce) final String
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
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:
isBooleanValue
in interfaceXContentParser
- Returns:
- true iff the current value is either boolean (
true
orfalse
) or one of "false", "true". - Throws:
IOException
-
booleanValue
- Specified by:
booleanValue
in interfaceXContentParser
- Throws:
IOException
-
doBooleanValue
- Throws:
IOException
-
shortValue
- Specified by:
shortValue
in interfaceXContentParser
- Throws:
IOException
-
shortValue
- Specified by:
shortValue
in interfaceXContentParser
- Throws:
IOException
-
doShortValue
- Throws:
IOException
-
intValue
- Specified by:
intValue
in interfaceXContentParser
- Throws:
IOException
-
intValue
- Specified by:
intValue
in interfaceXContentParser
- Throws:
IOException
-
doIntValue
- Throws:
IOException
-
longValue
- Specified by:
longValue
in interfaceXContentParser
- Throws:
IOException
-
longValue
- Specified by:
longValue
in interfaceXContentParser
- Throws:
IOException
-
doLongValue
- Throws:
IOException
-
floatValue
- Specified by:
floatValue
in interfaceXContentParser
- Throws:
IOException
-
floatValue
- Specified by:
floatValue
in interfaceXContentParser
- Throws:
IOException
-
doFloatValue
- Throws:
IOException
-
doubleValue
- Specified by:
doubleValue
in interfaceXContentParser
- Throws:
IOException
-
doubleValue
- Specified by:
doubleValue
in interfaceXContentParser
- Throws:
IOException
-
doDoubleValue
- Throws:
IOException
-
textOrNull
- Specified by:
textOrNull
in interfaceXContentParser
- Throws:
IOException
-
charBufferOrNull
- Specified by:
charBufferOrNull
in interfaceXContentParser
- Throws:
IOException
-
map
- Specified by:
map
in interfaceXContentParser
- Throws:
IOException
-
mapOrdered
- Specified by:
mapOrdered
in interfaceXContentParser
- Throws:
IOException
-
mapStrings
- Specified by:
mapStrings
in 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:XContentParser
Returns an instance ofMap
holding parsed map. Serves as a replacement for the "map", "mapOrdered" and "mapStrings" methods above.- Specified by:
map
in interfaceXContentParser
- Type Parameters:
T
- map value type- Parameters:
mapFactory
- factory for creating newMap
objectsmapValueParser
- parser for parsing a single map value- Returns:
Map
object- Throws:
IOException
-
list
- Specified by:
list
in interfaceXContentParser
- Throws:
IOException
-
listOrderedMap
- Specified by:
listOrderedMap
in interfaceXContentParser
- Throws:
IOException
-
readValue
public static Object readValue(XContentParser parser, Supplier<Map<String, Object>> mapFactory) throws IOException- Throws:
IOException
-
namedObject
Description copied from interface:XContentParser
Parse an object by name.- Specified by:
namedObject
in interfaceXContentParser
- Throws:
IOException
-
getXContentRegistry
Description copied from interface:XContentParser
The registry used to resolveXContentParser.namedObject(Class, String, Object)
. Use this when building a sub-parser from this parser.- Specified by:
getXContentRegistry
in interfaceXContentParser
-
isClosed
public abstract boolean isClosed()- Specified by:
isClosed
in interfaceXContentParser
-
getRestApiVersion
- Specified by:
getRestApiVersion
in interfaceXContentParser
-
getDeprecationHandler
Description copied from interface:XContentParser
The callback to notify when parsing encounters a deprecated field.- Specified by:
getDeprecationHandler
in interfaceXContentParser
-