Class AbstractXContentParser
- java.lang.Object
-
- org.elasticsearch.common.xcontent.support.AbstractXContentParser
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,XContentParser
- Direct Known Subclasses:
JsonXContentParser
public abstract class AbstractXContentParser extends java.lang.Object implements XContentParser
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.XContentParser
XContentParser.NumberType, XContentParser.Token
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_NUMBER_COERCE_POLICY
-
Constructor Summary
Constructors Constructor Description AbstractXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
booleanValue()
boolean
booleanValueLenient()
Deprecated.java.nio.CharBuffer
charBufferOrNull()
protected abstract boolean
doBooleanValue()
protected abstract double
doDoubleValue()
protected abstract float
doFloatValue()
protected abstract int
doIntValue()
protected abstract long
doLongValue()
protected abstract short
doShortValue()
double
doubleValue()
double
doubleValue(boolean coerce)
float
floatValue()
float
floatValue(boolean coerce)
DeprecationHandler
getDeprecationHandler()
The callback to notify when parsing encounters a deprecated field.NamedXContentRegistry
getXContentRegistry()
The registry used to resolveXContentParser.namedObject(Class, String, Object)
.int
intValue()
int
intValue(boolean coerce)
boolean
isBooleanValue()
boolean
isBooleanValueLenient()
Deprecated.abstract boolean
isClosed()
java.util.List<java.lang.Object>
list()
java.util.List<java.lang.Object>
listOrderedMap()
long
longValue()
long
longValue(boolean coerce)
java.util.Map<java.lang.String,java.lang.Object>
map()
java.util.Map<java.lang.String,java.lang.Object>
mapOrdered()
java.util.Map<java.lang.String,java.lang.String>
mapStrings()
java.util.Map<java.lang.String,java.lang.String>
mapStringsOrdered()
<T> T
namedObject(java.lang.Class<T> categoryClass, java.lang.String name, java.lang.Object context)
Parse an object by name.short
shortValue()
short
shortValue(boolean coerce)
java.lang.String
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.common.xcontent.XContentParser
binaryValue, charBuffer, contentType, currentName, currentToken, getTokenLocation, hasTextCharacters, nextToken, numberType, numberValue, objectBytes, objectText, skipChildren, text, textCharacters, textLength, textOffset
-
-
-
-
Field Detail
-
DEFAULT_NUMBER_COERCE_POLICY
public static final boolean DEFAULT_NUMBER_COERCE_POLICY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractXContentParser
public AbstractXContentParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler)
-
-
Method Detail
-
isBooleanValue
public boolean isBooleanValue() throws java.io.IOException
- Specified by:
isBooleanValue
in interfaceXContentParser
- Returns:
- true iff the current value is either boolean (
true
orfalse
) or one of "false", "true". - Throws:
java.io.IOException
-
booleanValue
public boolean booleanValue() throws java.io.IOException
- Specified by:
booleanValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
isBooleanValueLenient
@Deprecated public boolean isBooleanValueLenient() throws java.io.IOException
Deprecated.Description copied from interface:XContentParser
returns true if the current value is boolean in nature. values that are considered booleans: - boolean value (true/false) - numeric integers (=0 is considered as false, !=0 is true) - one of the following strings: "true","false","on","off","yes","no","1","0"- Specified by:
isBooleanValueLenient
in interfaceXContentParser
- Throws:
java.io.IOException
-
booleanValueLenient
@Deprecated public boolean booleanValueLenient() throws java.io.IOException
Deprecated.- Specified by:
booleanValueLenient
in interfaceXContentParser
- Throws:
java.io.IOException
-
doBooleanValue
protected abstract boolean doBooleanValue() throws java.io.IOException
- Throws:
java.io.IOException
-
shortValue
public short shortValue() throws java.io.IOException
- Specified by:
shortValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
shortValue
public short shortValue(boolean coerce) throws java.io.IOException
- Specified by:
shortValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
doShortValue
protected abstract short doShortValue() throws java.io.IOException
- Throws:
java.io.IOException
-
intValue
public int intValue() throws java.io.IOException
- Specified by:
intValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
intValue
public int intValue(boolean coerce) throws java.io.IOException
- Specified by:
intValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
doIntValue
protected abstract int doIntValue() throws java.io.IOException
- Throws:
java.io.IOException
-
longValue
public long longValue() throws java.io.IOException
- Specified by:
longValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
longValue
public long longValue(boolean coerce) throws java.io.IOException
- Specified by:
longValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
doLongValue
protected abstract long doLongValue() throws java.io.IOException
- Throws:
java.io.IOException
-
floatValue
public float floatValue() throws java.io.IOException
- Specified by:
floatValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
floatValue
public float floatValue(boolean coerce) throws java.io.IOException
- Specified by:
floatValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
doFloatValue
protected abstract float doFloatValue() throws java.io.IOException
- Throws:
java.io.IOException
-
doubleValue
public double doubleValue() throws java.io.IOException
- Specified by:
doubleValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
doubleValue
public double doubleValue(boolean coerce) throws java.io.IOException
- Specified by:
doubleValue
in interfaceXContentParser
- Throws:
java.io.IOException
-
doDoubleValue
protected abstract double doDoubleValue() throws java.io.IOException
- Throws:
java.io.IOException
-
textOrNull
public final java.lang.String textOrNull() throws java.io.IOException
- Specified by:
textOrNull
in interfaceXContentParser
- Throws:
java.io.IOException
-
charBufferOrNull
public java.nio.CharBuffer charBufferOrNull() throws java.io.IOException
- Specified by:
charBufferOrNull
in interfaceXContentParser
- Throws:
java.io.IOException
-
map
public java.util.Map<java.lang.String,java.lang.Object> map() throws java.io.IOException
- Specified by:
map
in interfaceXContentParser
- Throws:
java.io.IOException
-
mapOrdered
public java.util.Map<java.lang.String,java.lang.Object> mapOrdered() throws java.io.IOException
- Specified by:
mapOrdered
in interfaceXContentParser
- Throws:
java.io.IOException
-
mapStrings
public java.util.Map<java.lang.String,java.lang.String> mapStrings() throws java.io.IOException
- Specified by:
mapStrings
in interfaceXContentParser
- Throws:
java.io.IOException
-
mapStringsOrdered
public java.util.Map<java.lang.String,java.lang.String> mapStringsOrdered() throws java.io.IOException
- Specified by:
mapStringsOrdered
in interfaceXContentParser
- Throws:
java.io.IOException
-
list
public java.util.List<java.lang.Object> list() throws java.io.IOException
- Specified by:
list
in interfaceXContentParser
- Throws:
java.io.IOException
-
listOrderedMap
public java.util.List<java.lang.Object> listOrderedMap() throws java.io.IOException
- Specified by:
listOrderedMap
in interfaceXContentParser
- Throws:
java.io.IOException
-
namedObject
public <T> T namedObject(java.lang.Class<T> categoryClass, java.lang.String name, java.lang.Object context) throws java.io.IOException
Description copied from interface:XContentParser
Parse an object by name.- Specified by:
namedObject
in interfaceXContentParser
- Throws:
java.io.IOException
-
getXContentRegistry
public NamedXContentRegistry 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
-
getDeprecationHandler
public DeprecationHandler getDeprecationHandler()
Description copied from interface:XContentParser
The callback to notify when parsing encounters a deprecated field.- Specified by:
getDeprecationHandler
in interfaceXContentParser
-
-