Example usage for com.fasterxml.jackson.core JsonParser nextBooleanValue

List of usage examples for com.fasterxml.jackson.core JsonParser nextBooleanValue

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonParser nextBooleanValue.

Prototype

public Boolean nextBooleanValue() throws IOException, JsonParseException 

Source Link

Document

Method that fetches next token (as if calling #nextToken ) and if it is JsonToken#VALUE_TRUE or JsonToken#VALUE_FALSE returns matching Boolean value; otherwise return null.

Usage

From source file:eu.project.ttc.readers.TermSuiteJsonCasDeserializer.java

private static void fillSdi(JsonParser parser, JsonToken token, SourceDocumentInformation sdi)
        throws IOException {
    if (token.equals(JsonToken.FIELD_NAME)) {
        switch (parser.getCurrentName()) {
        case F_URI:
            sdi.setUri(parser.nextTextValue());
            break;
        case F_OFFSET_IN_SOURCE:
            sdi.setOffsetInSource(parser.nextIntValue(0));
            break;
        case F_DOCUMENT_INDEX:
            sdi.setDocumentIndex(parser.nextIntValue(0));
            break;
        case F_NB_DOCUMENTS:
            sdi.setNbDocuments(parser.nextIntValue(0));
            break;
        case F_DOCUMENT_SIZE:
            sdi.setDocumentSize(parser.nextIntValue(0));
            break;
        case F_CUMULATED_DOCUMENT_SIZE:
            sdi.setCumulatedDocumentSize(parser.nextLongValue(0));
            break;
        case F_CORPUS_SIZE:
            sdi.setCorpusSize(parser.nextLongValue(0));
            break;
        case F_LAST_SEGMENT:
            sdi.setLastSegment(parser.nextBooleanValue());
            break;
        case F_BEGIN:
            sdi.setBegin(parser.nextIntValue(0));
            break;
        case F_END:
            sdi.setEnd(parser.nextIntValue(0));
            break;
        }//from ww w  .  j av  a  2 s  .  com
    }
}