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("{\"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 XContentBuilderString variants of the separated value methods. |
boolean |
booleanValue() |
XContentType |
contentType() |
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.
|
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()
returns true if the current value is boolean in nature.
|
boolean |
isClosed() |
List<Object> |
list() |
List<Object> |
listOrderedMap() |
long |
longValue() |
long |
longValue(boolean coerce) |
Map<String,Object> |
map() |
Map<String,Object> |
mapOrdered() |
XContentParser.Token |
nextToken() |
XContentParser.NumberType |
numberType() |
Number |
numberValue() |
Object |
objectBytes() |
Object |
objectText() |
short |
shortValue() |
short |
shortValue(boolean coerce) |
void |
skipChildren() |
String |
text() |
char[] |
textCharacters() |
int |
textLength() |
int |
textOffset() |
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 IOException
IOException
void skipChildren() throws IOException
IOException
XContentParser.Token currentToken()
String currentName() throws IOException
IOException
Map<String,Object> map() throws IOException
IOException
Map<String,Object> mapOrdered() throws IOException
IOException
List<Object> list() throws IOException
IOException
List<Object> listOrderedMap() throws IOException
IOException
String text() throws IOException
IOException
String textOrNull() throws IOException
IOException
org.apache.lucene.util.BytesRef utf8BytesOrNull() throws IOException
XContentParser.Token.VALUE_NULL
.
This method should be used to read text only binary content should be read through binaryValue()
IOException
org.apache.lucene.util.BytesRef utf8Bytes() throws IOException
binaryValue()
IOException
Object objectText() throws IOException
IOException
Object objectBytes() throws IOException
IOException
boolean hasTextCharacters()
char[] textCharacters() throws IOException
IOException
int textLength() throws IOException
IOException
int textOffset() throws IOException
IOException
Number numberValue() throws IOException
IOException
XContentParser.NumberType numberType() throws IOException
IOException
short shortValue(boolean coerce) throws IOException
IOException
int intValue(boolean coerce) throws IOException
IOException
long longValue(boolean coerce) throws IOException
IOException
float floatValue(boolean coerce) throws IOException
IOException
double doubleValue(boolean coerce) throws IOException
IOException
short shortValue() throws IOException
IOException
int intValue() throws IOException
IOException
long longValue() throws IOException
IOException
float floatValue() throws IOException
IOException
double doubleValue() throws IOException
IOException
boolean isBooleanValue() throws IOException
IOException
boolean booleanValue() throws IOException
IOException
byte[] binaryValue() throws 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[])
}XContentBuilderString
variants of the separated value methods.
Note: Do not use this method to read values written with:
XContentBuilder.utf8Field(XContentBuilderString, org.apache.lucene.util.BytesRef)
XContentBuilder.utf8Field(String, org.apache.lucene.util.BytesRef)
utf8Bytes()
utf8BytesOrNull()
}text()
()}textOrNull()
()}textCharacters()
()}}IOException
XContentLocation getTokenLocation()
boolean isClosed()
Copyright © 2009–2016. All rights reserved.