add inline comments on GetField binary values parsing

This commit is contained in:
javanna 2016-12-19 19:26:32 +01:00 committed by Luca Cavanna
parent 2d71ced221
commit 04d929ff53
1 changed files with 2 additions and 0 deletions

View File

@ -121,12 +121,14 @@ public class GetField implements Streamable, ToXContent, Iterable<Object> {
while((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
Object value;
if (token == XContentParser.Token.VALUE_STRING) {
//binary values will be parsed back and returned as base64 strings when reading from json and yaml
value = parser.text();
} else if (token == XContentParser.Token.VALUE_NUMBER) {
value = parser.numberValue();
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
value = parser.booleanValue();
} else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {
//binary values will be parsed back and returned as BytesArray when reading from cbor and smile
value = new BytesArray(parser.binaryValue());
} else {
throw new ParsingException(parser.getTokenLocation(), "Failed to parse object: unsupported token found [" + token + "]");