类com.fasterxml.jackson.core.json.JsonReadContext源码实例Demo

下面列出了怎么用com.fasterxml.jackson.core.json.JsonReadContext的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: NonBlockingJsonParserBase.java
protected final JsonToken _closeArrayScope() throws IOException
{
    if (!_parsingContext.inArray()) {
        _reportMismatchedEndMarker(']', '}');
    }
    JsonReadContext ctxt = _parsingContext.getParent();
    _parsingContext = ctxt;
    int st;
    if (ctxt.inObject()) {
        st = MAJOR_OBJECT_FIELD_NEXT;
    } else if (ctxt.inArray()) {
        st = MAJOR_ARRAY_ELEMENT_NEXT;
    } else {
        st = MAJOR_ROOT;
    }
    _majorState = st;
    _majorStateAfterValue = st;
    return (_currToken = JsonToken.END_ARRAY);
}
 
源代码2 项目: lams   文件: NonBlockingJsonParserBase.java
protected final JsonToken _closeObjectScope() throws IOException
{
    if (!_parsingContext.inObject()) {
        _reportMismatchedEndMarker('}', ']');
    }
    JsonReadContext ctxt = _parsingContext.getParent();
    _parsingContext = ctxt;
    int st;
    if (ctxt.inObject()) {
        st = MAJOR_OBJECT_FIELD_NEXT;
    } else if (ctxt.inArray()) {
        st = MAJOR_ARRAY_ELEMENT_NEXT;
    } else {
        st = MAJOR_ROOT;
    }
    _majorState = st;
    _majorStateAfterValue = st;
    return (_currToken = JsonToken.END_OBJECT);
}
 
源代码3 项目: lams   文件: TokenBufferReadContext.java
protected TokenBufferReadContext(JsonStreamContext base, Object srcRef) {
    super(base);
    _parent = base.getParent();
    _currentName = base.getCurrentName();
    _currentValue = base.getCurrentValue();
    if (base instanceof JsonReadContext) {
        JsonReadContext rc = (JsonReadContext) base;
        _startLocation = rc.getStartLocation(srcRef);
    } else {
        _startLocation = JsonLocation.NA;
    }
}
 
源代码4 项目: lams   文件: ParserBase.java
protected ParserBase(IOContext ctxt, int features) {
    super(features);
    _ioContext = ctxt;
    _textBuffer = ctxt.constructTextBuffer();
    DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features)
            ? DupDetector.rootDetector(this) : null;
    _parsingContext = JsonReadContext.createRootContext(dups);
}
 
源代码5 项目: lams   文件: ParserBase.java
/**
 * Method that can be called to get the name associated with
 * the current event.
 */
@Override public String getCurrentName() throws IOException {
    // [JACKSON-395]: start markers require information from parent
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = _parsingContext.getParent();
        if (parent != null) {
            return parent.getCurrentName();
        }
    }
    return _parsingContext.getCurrentName();
}
 
源代码6 项目: lams   文件: ParserBase.java
@Override public void overrideCurrentName(String name) {
    // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing:
    JsonReadContext ctxt = _parsingContext;
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        ctxt = ctxt.getParent();
    }
    /* 24-Sep-2013, tatu: Unfortunate, but since we did not expose exceptions,
     *   need to wrap this here
     */
    try {
        ctxt.setCurrentName(name);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}
 
源代码7 项目: openbd-core   文件: ParserBase.java
protected ParserBase(IOContext ctxt, int features) {
    super(features);
    _ioContext = ctxt;
    _textBuffer = ctxt.constructTextBuffer();
    DupDetector dups = Feature.STRICT_DUPLICATE_DETECTION.enabledIn(features)
            ? DupDetector.rootDetector(this) : null;
    _parsingContext = JsonReadContext.createRootContext(dups);
}
 
源代码8 项目: openbd-core   文件: ParserBase.java
/**
 * Method that can be called to get the name associated with
 * the current event.
 */
@Override public String getCurrentName() throws IOException {
    // [JACKSON-395]: start markers require information from parent
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = _parsingContext.getParent();
        return parent.getCurrentName();
    }
    return _parsingContext.getCurrentName();
}
 
源代码9 项目: openbd-core   文件: ParserBase.java
@Override public void overrideCurrentName(String name) {
    // Simple, but need to look for START_OBJECT/ARRAY's "off-by-one" thing:
    JsonReadContext ctxt = _parsingContext;
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        ctxt = ctxt.getParent();
    }
    /* 24-Sep-2013, tatu: Unfortunate, but since we did not expose exceptions,
     *   need to wrap this here
     */
    try {
        ctxt.setCurrentName(name);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}
 
@Override public String getCurrentName() throws IOException {
    if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
        JsonReadContext parent = parsingContext.getParent();
        return parent.getCurrentName();
    }
    return parsingContext.getCurrentName();
}
 
源代码11 项目: lams   文件: ParserBase.java
protected void _reportMismatchedEndMarker(int actCh, char expCh) throws JsonParseException {
    JsonReadContext ctxt = getParsingContext();
    _reportError(String.format(
            "Unexpected close marker '%s': expected '%c' (for %s starting at %s)",
            (char) actCh, expCh, ctxt.typeDesc(), ctxt.getStartLocation(_getSourceReference())));
}
 
源代码12 项目: lams   文件: ParserBase.java
@Override public JsonReadContext getParsingContext() { return _parsingContext; } 
源代码13 项目: openbd-core   文件: ParserBase.java
@Override public JsonReadContext getParsingContext() { return _parsingContext; } 
 类方法
 同包方法