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/deser/impl/InnerClassProperty.java
package com.fasterxml.jackson.databind.deser.impl;
import java.io.IOException;
import java.lang.reflect.Constructor;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.SettableBeanProperty;
import com.fasterxml.jackson.databind.introspect.*;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* This sub-class is used to handle special case of value being a
* non-static inner class. If so, we will have to use a special
* alternative for default constructor; but otherwise can delegate
* to regular implementation.
*/
public final class InnerClassProperty
extends SettableBeanProperty.Delegating
{
private static final long serialVersionUID = 1L;
/**
* Constructor used when deserializing this property.
* Transient since there is no need to persist; only needed during
* construction of objects.
*/
final protected transient Constructor<?> _creator;
/**
* Serializable version of single-arg constructor we use for value instantiation.
*/
protected AnnotatedConstructor _annotated;
public InnerClassProperty(SettableBeanProperty delegate,
Constructor<?> ctor)
{
super(delegate);
_creator = ctor;
}
/**
* Constructor used with JDK Serialization; needed to handle transient
* Constructor, wrap/unwrap in/out-of Annotated variant.
*/
protected InnerClassProperty(SettableBeanProperty src, AnnotatedConstructor ann)
{
super(src);
_annotated = ann;
_creator = (_annotated == null) ? null : _annotated.getAnnotated();
if (_creator == null) {
throw new IllegalArgumentException("Missing constructor (broken JDK (de)serialization?)");
}
}
@Override
protected SettableBeanProperty withDelegate(SettableBeanProperty d) {
if (d == this.delegate) {
return this;
}
return new InnerClassProperty(d, _creator);
}
/*
/**********************************************************
/* Deserialization methods
/**********************************************************
*/
@Override
public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object bean)
throws IOException
{
JsonToken t = p.currentToken();
Object value;
if (t == JsonToken.VALUE_NULL) {
value = _valueDeserializer.getNullValue(ctxt);
} else if (_valueTypeDeserializer != null) {
value = _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer);
} else { // the usual case
try {
value = _creator.newInstance(bean);
} catch (Exception e) {
ClassUtil.unwrapAndThrowAsIAE(e, String.format(
"Failed to instantiate class %s, problem: %s",
_creator.getDeclaringClass().getName(), e.getMessage()));
value = null;
}
_valueDeserializer.deserialize(p, ctxt, value);
}
set(bean, value);
}
@Override
public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance)
throws IOException
{
return setAndReturn(instance, deserialize(p, ctxt));
}
// these are fine with defaults
// public final void set(Object instance, Object value) throws IOException { }
// public Object setAndReturn(Object instance, Object value) throws IOException { }
/*
/**********************************************************
/* JDK serialization handling
/**********************************************************
*/
// When reading things back,
Object readResolve() {
return new InnerClassProperty(this, _annotated);
}
Object writeReplace() {
// need to construct a fake instance to support serialization
if (_annotated == null) {
return new InnerClassProperty(this, new AnnotatedConstructor(null, _creator, null, null));
}
return this;
}
}
⏎ com/fasterxml/jackson/databind/deser/impl/InnerClassProperty.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, ≈298🔥, 0💬
Popular Posts:
HttpComponents Client Source Code Files are provided in the source package file, httpcomponents-clie...
JDK 11 jdk.charsets.jmod is the JMOD file for JDK 11 Charsets module. JDK 11 Charsets module compile...
JDK 17 jdk.jdi.jmod is the JMOD file for JDK 17 JDI (Java Debug Interface) tool. JDK 17 JDI tool com...
How to download and install ojdbc7.jar for Oracle 12c R1? ojdbc8.jar for Oracle 12c R1 is a Java 7 a...
How to download and install mysql-connector-j-8.0.31 .zip?Connector/J Java library is a JDBC Driver ...