Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Jackson Data Binding Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Databind Source Code files are provided in the source packge (jackson-databind-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Databind Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/util/TokenBufferReadContext.java
package com.fasterxml.jackson.databind.util;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.io.ContentReference;
import com.fasterxml.jackson.core.json.JsonReadContext;
/**
* Implementation of {@link JsonStreamContext} used by {@link TokenBuffer}
* to link back to the original context to try to keep location information
* consistent between source location and buffered content when it's re-read
* from the buffer.
*
* @since 2.9
*/
public class TokenBufferReadContext extends JsonStreamContext
{
protected final JsonStreamContext _parent;
protected final JsonLocation _startLocation;
// Benefit for reusing?
// protected JsonReadContext _child;
/*
/**********************************************************
/* Location/state information (minus source reference)
/**********************************************************
*/
protected String _currentName;
protected Object _currentValue;
/**
* @since 2.13
*/
protected TokenBufferReadContext(JsonStreamContext base, ContentReference srcRef)
{
super(base);
_parent = base.getParent();
_currentName = base.getCurrentName();
_currentValue = base.getCurrentValue();
if (base instanceof JsonReadContext) {
JsonReadContext rc = (JsonReadContext) base;
_startLocation = rc.startLocation(srcRef);
} else {
_startLocation = JsonLocation.NA;
}
}
@Deprecated // @since 2.13
protected TokenBufferReadContext(JsonStreamContext base, Object srcRef) {
this(base, (srcRef instanceof ContentReference) ?
(ContentReference) srcRef :
ContentReference.rawReference(srcRef));
}
protected TokenBufferReadContext(JsonStreamContext base, JsonLocation startLoc) {
super(base);
_parent = base.getParent();
_currentName = base.getCurrentName();
_currentValue = base.getCurrentValue();
_startLocation = startLoc;
}
/**
* Constructor for case where there is no real surrounding context: just create
* virtual ROOT
*/
protected TokenBufferReadContext() {
super(TYPE_ROOT, -1);
_parent = null;
_startLocation = JsonLocation.NA;
}
protected TokenBufferReadContext(TokenBufferReadContext parent, int type, int index) {
super(type, index);
_parent = parent;
_startLocation = parent._startLocation;
}
@Override
public Object getCurrentValue() {
return _currentValue;
}
@Override
public void setCurrentValue(Object v) {
_currentValue = v;
}
/*
/**********************************************************
/* Factory methods
/**********************************************************
*/
public static TokenBufferReadContext createRootContext(JsonStreamContext origContext) {
// First: possible to have no current context; if so, just create bogus ROOT context
if (origContext == null) {
return new TokenBufferReadContext();
}
return new TokenBufferReadContext(origContext, ContentReference.unknown());
}
public TokenBufferReadContext createChildArrayContext() {
// For current context there will be one next Array value, first:
++_index;
return new TokenBufferReadContext(this, TYPE_ARRAY, -1);
}
public TokenBufferReadContext createChildObjectContext() {
// For current context there will be one next Object value, first:
++_index;
return new TokenBufferReadContext(this, TYPE_OBJECT, -1);
}
/**
* Helper method we need to handle discontinuity between "real" contexts buffer
* creates, and ones from parent: problem being they are of different types.
*/
public TokenBufferReadContext parentOrCopy() {
// 30-Apr-2017, tatu: This is bit awkward since part on ancestor stack is of different
// type (usually `JsonReadContext`)... and so for unbalanced buffers (with extra
// END_OBJECT / END_ARRAY), we may need to create
if (_parent instanceof TokenBufferReadContext) {
return (TokenBufferReadContext) _parent;
}
if (_parent == null) { // unlikely, but just in case let's support
return new TokenBufferReadContext();
}
return new TokenBufferReadContext(_parent, _startLocation);
}
/*
/**********************************************************
/* Abstract method implementation
/**********************************************************
*/
@Override public String getCurrentName() { return _currentName; }
// @since 2.9
@Override public boolean hasCurrentName() { return _currentName != null; }
@Override public JsonStreamContext getParent() { return _parent; }
public void setCurrentName(String name) throws JsonProcessingException {
_currentName = name;
}
/*
/**********************************************************
/* Extended support for context updates
/**********************************************************
*/
/**
* @since 2.10.1
*/
public void updateForValue() {
++_index;
}
}
⏎ com/fasterxml/jackson/databind/util/TokenBufferReadContext.java
Or download all of them as a single archive file:
File name: jackson-databind-2.14.0-sources.jar File size: 1187952 bytes Release date: 2022-11-05 Download
⇒ Jackson Annotations Source Code
⇐ Download and Install Jackson Binary Package
2022-03-29, ≈244🔥, 0💬
Popular Posts:
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
How to perform XML Schema validation with sax\Writer.java provided in the Apache Xerces package? You...
JDK 11 java.rmi.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) module. JDK 11 RMI m...
Apache Ant Source Code Files are inside the Apache Ant source package file like apache-ant-1.10.10-s...
Xalan-Java, Version 2.7.1, is an XSLT processor for transforming XML documents into HTML, text, or o...