Example usage for com.fasterxml.jackson.core.json JsonWriteContext STATUS_EXPECT_NAME

List of usage examples for com.fasterxml.jackson.core.json JsonWriteContext STATUS_EXPECT_NAME

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core.json JsonWriteContext STATUS_EXPECT_NAME.

Prototype

int STATUS_EXPECT_NAME

To view the source code for com.fasterxml.jackson.core.json JsonWriteContext STATUS_EXPECT_NAME.

Click Source Link

Usage

From source file:de.undercouch.bson4jackson.BsonGenerator.java

@Override
protected void _verifyValueWrite(String typeMsg) throws IOException {
    int status = _writeContext.writeValue();
    if (status == JsonWriteContext.STATUS_EXPECT_NAME) {
        _reportError("Can not " + typeMsg + ", expecting field name");
    }//from w ww.j  a v  a2 s  . c om
}

From source file:com.bazaarvoice.jackson.rison.RisonGenerator.java

@Override
protected final void _verifyValueWrite(String typeMsg) throws IOException, JsonGenerationException {
    int status = _writeContext.writeValue();
    if (status == JsonWriteContext.STATUS_EXPECT_NAME) {
        _reportError("Can not " + typeMsg + ", expecting field name");
    }//from  w  w  w  . j  a va2  s  .co  m
    char c;
    switch (status) {
    case JsonWriteContext.STATUS_OK_AFTER_COMMA:
        c = ',';
        break;
    case JsonWriteContext.STATUS_OK_AFTER_COLON:
        c = ':';
        break;
    case JsonWriteContext.STATUS_OK_AFTER_SPACE:
        if (_rootValueSeparator != null) {
            _writeRaw(_rootValueSeparator.getValue());
        }
        return;
    case JsonWriteContext.STATUS_OK_AS_IS:
    default:
        return;
    }
    if (_outputTail >= _outputEnd) {
        _flushBuffer();
    }
    _outputBuffer[_outputTail++] = c;
}