Categories:
Audio (13)
Biotech (29)
Bytecode (35)
Database (77)
Framework (7)
Game (7)
General (512)
Graphics (53)
I/O (32)
IDE (2)
JAR Tools (86)
JavaBeans (16)
JDBC (89)
JDK (337)
JSP (20)
Logging (103)
Mail (54)
Messaging (8)
Network (71)
PDF (94)
Report (7)
Scripting (83)
Security (32)
Server (119)
Servlet (17)
SOAP (24)
Testing (50)
Web (19)
XML (301)
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.12.4-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/MergingSettableBeanProperty.java
package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** * {@link SettableBeanProperty} implementation that will try to access value of * the property first, and if non-null value found, pass that for update * (using {@link com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, Object)}) * instead of constructing a new value. This is necessary to support "merging" properties. *<p> * Note that there are many similarities to {@link SetterlessProperty}, which predates * this variant; and that one is even used in cases where there is no mutator * available. * * @since 2.9 */ public class MergingSettableBeanProperty extends SettableBeanProperty.Delegating { private static final long serialVersionUID = 1L; /** * Member (field, method) used for accessing existing value. */ protected final AnnotatedMember _accessor; /* /********************************************************** /* Life-cycle /********************************************************** */ protected MergingSettableBeanProperty(SettableBeanProperty delegate, AnnotatedMember accessor) { super(delegate); _accessor = accessor; } protected MergingSettableBeanProperty(MergingSettableBeanProperty src, SettableBeanProperty delegate) { super(delegate); _accessor = src._accessor; } public static MergingSettableBeanProperty construct(SettableBeanProperty delegate, AnnotatedMember accessor) { return new MergingSettableBeanProperty(delegate, accessor); } @Override protected SettableBeanProperty withDelegate(SettableBeanProperty d) { return new MergingSettableBeanProperty(d, _accessor); } /* /********************************************************** /* Deserialization methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { Object oldValue = _accessor.getValue(instance); Object newValue; // 20-Oct-2016, tatu: Couple of possibilities of how to proceed; for // now, default to "normal" handling without merging if (oldValue == null) { newValue = delegate.deserialize(p, ctxt); } else { newValue = delegate.deserializeWith(p, ctxt, oldValue); } if (newValue != oldValue) { // 18-Apr-2017, tatu: Null handling should occur within delegate, which may // set/skip/transform it, or throw an exception. delegate.set(instance, newValue); } } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { Object oldValue = _accessor.getValue(instance); Object newValue; // 20-Oct-2016, tatu: Couple of possibilities of how to proceed; for // now, default to "normal" handling without merging if (oldValue == null) { newValue = delegate.deserialize(p, ctxt); } else { newValue = delegate.deserializeWith(p, ctxt, oldValue); } // 23-Oct-2016, tatu: One possible complication here; should we always // try calling setter on builder? Presumably should not be required, // but may need to revise if (newValue != oldValue) { // 31-Oct-2016, tatu: Basically should just ignore as null can't really // contribute to merging. if (newValue != null) { return delegate.setAndReturn(instance, newValue); } } return instance; } @Override public void set(Object instance, Object value) throws IOException { // 31-Oct-2016, tatu: Basically should just ignore as null can't really // contribute to merging. if (value != null) { delegate.set(instance, value); } } @Override public Object setAndReturn(Object instance, Object value) throws IOException { // 31-Oct-2016, tatu: Basically should just ignore as null can't really // contribute to merging. if (value != null) { return delegate.setAndReturn(instance, value); } return instance; } }
⏎ com/fasterxml/jackson/databind/deser/impl/MergingSettableBeanProperty.java
Â
⇒ Jackson Annotations Source Code
⇠Download and Install Jackson Binary Package
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-03-29, 31893👍, 0💬
Popular Posts:
Saxon is an open source product available under the Mozilla Public License. It provides implementati...
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
JDK 11 jdk.jconsole.jmod is the JMOD file for JDK 11 JConsole tool, which can be invoked by the "jco...
How to run "javac" command from JDK tools.jar file? "javac" is the Java compiler command that allows...
Java Servlet 3.0 Specification API. JAR File Size and Download Location: File name: servlet-api.jar,...