public interface XContentParser extends Releasable
XContent
see XContentType
for supported types.
To obtain an instance of this class use the following pattern:
XContentType xContentType = XContentType.JSON; XContentParser parser = xContentType.xContent().createParser(NamedXContentRegistry.EMPTY, "{\"key\" : \"value\"}");
Modifier and Type | Interface and Description |
---|---|
static class |
XContentParser.NumberType |
static class |
XContentParser.Token |
Modifier and Type | Method and Description |
---|---|
byte[] |
binaryValue()
Reads a plain binary value that was written via one of the following methods:
XContentBuilder.field(String, org.apache.lucene.util.BytesRef)
XContentBuilder.field(String, org.elasticsearch.common.bytes.BytesReference)
XContentBuilder.field(String, byte[], int, int) }
XContentBuilder.field(String, byte[]) }
as well as via their String variants of the separated value methods. |
boolean |
booleanValue() |
boolean |
booleanValueLenient()
Deprecated.
Just present for providing backwards compatibility. Use
booleanValue() instead. |
XContentType |
contentType() |
java.lang.String |
currentName() |
XContentParser.Token |
currentToken() |
double |
doubleValue() |
double |
doubleValue(boolean coerce) |
float |
floatValue() |
float |
floatValue(boolean coerce) |
XContentLocation |
getTokenLocation()
Used for error reporting to highlight where syntax errors occur in
content being parsed.
|
NamedXContentRegistry |
getXContentRegistry()
The registry used to resolve
namedObject(Class, String, Object) . |
boolean |
hasTextCharacters()
Method that can be used to determine whether calling of textCharacters() would be the most efficient way to
access textual content for the event parser currently points to.
|
int |
intValue() |
int |
intValue(boolean coerce) |
boolean |
isBooleanValue() |
boolean |
isBooleanValueLenient()
Deprecated.
Just present for providing backwards compatibility. Use
isBooleanValue() instead. |
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.
|
XContentParser.Token |
nextToken() |
XContentParser.NumberType |
numberType() |
java.lang.Number |
numberValue() |
java.lang.Object |
objectBytes() |
java.lang.Object |
objectText() |
short |
shortValue() |
short |
shortValue(boolean coerce) |
void |
skipChildren() |
java.lang.String |
text() |
char[] |
textCharacters() |
int |
textLength() |
int |
textOffset() |
java.lang.String |
textOrNull() |
org.apache.lucene.util.BytesRef |
utf8Bytes()
Returns a BytesRef holding UTF-8 bytes.
|
org.apache.lucene.util.BytesRef |
utf8BytesOrNull()
Returns a BytesRef holding UTF-8 bytes or null if a null value is
XContentParser.Token.VALUE_NULL . |
close
XContentType contentType()
XContentParser.Token nextToken() throws java.io.IOException
java.io.IOException
void skipChildren() throws java.io.IOException
java.io.IOException
XContentParser.Token currentToken()
java.lang.String currentName() throws java.io.IOException
java.io.IOException
java.util.Map<java.lang.String,java.lang.Object> map() throws java.io.IOException
java.io.IOException
java.util.Map<java.lang.String,java.lang.Object> mapOrdered() throws java.io.IOException
java.io.IOException
java.util.Map<java.lang.String,java.lang.String> mapStrings() throws java.io.IOException
java.io.IOException
java.util.Map<java.lang.String,java.lang.String> mapStringsOrdered() throws java.io.IOException
java.io.IOException
java.util.List<java.lang.Object> list() throws java.io.IOException
java.io.IOException
java.util.List<java.lang.Object> listOrderedMap() throws java.io.IOException
java.io.IOException
java.lang.String text() throws java.io.IOException
java.io.IOException
java.lang.String textOrNull() throws java.io.IOException
java.io.IOException
org.apache.lucene.util.BytesRef utf8BytesOrNull() throws java.io.IOException
XContentParser.Token.VALUE_NULL
.
This method should be used to read text only binary content should be read through binaryValue()
java.io.IOException
org.apache.lucene.util.BytesRef utf8Bytes() throws java.io.IOException
binaryValue()
java.io.IOException
java.lang.Object objectText() throws java.io.IOException
java.io.IOException
java.lang.Object objectBytes() throws java.io.IOException
java.io.IOException
boolean hasTextCharacters()
char[] textCharacters() throws java.io.IOException
java.io.IOException
int textLength() throws java.io.IOException
java.io.IOException
int textOffset() throws java.io.IOException
java.io.IOException
java.lang.Number numberValue() throws java.io.IOException
java.io.IOException
XContentParser.NumberType numberType() throws java.io.IOException
java.io.IOException
short shortValue(boolean coerce) throws java.io.IOException
java.io.IOException
int intValue(boolean coerce) throws java.io.IOException
java.io.IOException
long longValue(boolean coerce) throws java.io.IOException
java.io.IOException
float floatValue(boolean coerce) throws java.io.IOException
java.io.IOException
double doubleValue(boolean coerce) throws java.io.IOException
java.io.IOException
short shortValue() throws java.io.IOException
java.io.IOException
int intValue() throws java.io.IOException
java.io.IOException
long longValue() throws java.io.IOException
java.io.IOException
float floatValue() throws java.io.IOException
java.io.IOException
double doubleValue() throws java.io.IOException
java.io.IOException
boolean isBooleanValue() throws java.io.IOException
true
or false
) or one of "false", "true".java.io.IOException
boolean booleanValue() throws java.io.IOException
java.io.IOException
@Deprecated boolean isBooleanValueLenient() throws java.io.IOException
isBooleanValue()
instead.java.io.IOException
@Deprecated boolean booleanValueLenient() throws java.io.IOException
booleanValue()
instead.java.io.IOException
byte[] binaryValue() throws java.io.IOException
XContentBuilder.field(String, org.apache.lucene.util.BytesRef)
XContentBuilder.field(String, org.elasticsearch.common.bytes.BytesReference)
XContentBuilder.field(String, byte[], int, int)
}XContentBuilder.field(String, byte[])
}String
variants of the separated value methods.
Note: Do not use this method to read values written with:
XContentBuilder.utf8Field(String, org.apache.lucene.util.BytesRef)
XContentBuilder.utf8Field(String, org.apache.lucene.util.BytesRef)
utf8Bytes()
utf8BytesOrNull()
}text()
()}textOrNull()
()}textCharacters()
()}}java.io.IOException
XContentLocation getTokenLocation()
<T> T namedObject(java.lang.Class<T> categoryClass, java.lang.String name, java.lang.Object context) throws java.io.IOException
java.io.IOException
NamedXContentRegistry getXContentRegistry()
namedObject(Class, String, Object)
. Use this when building a sub-parser from this parser.boolean isClosed()