Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
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/ser/BeanSerializer.java
package com.fasterxml.jackson.databind.ser; import java.io.IOException; import java.util.Set; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.ser.impl.BeanAsArraySerializer; import com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter; import com.fasterxml.jackson.databind.ser.impl.UnwrappingBeanSerializer; import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; import com.fasterxml.jackson.databind.util.NameTransformer; /** * Serializer class that can serialize Java objects that map * to JSON Object output. Internally handling is mostly dealt with * by a sequence of {@link BeanPropertyWriter}s that will handle * access value to serialize and call appropriate serializers to * write out JSON. *<p> * Implementation note: we will post-process resulting serializer, * to figure out actual serializers for final types. This must be * done from {@link #resolve} method, and NOT from constructor; * otherwise we could end up with an infinite loop. */ public class BeanSerializer extends BeanSerializerBase { private static final long serialVersionUID = 29; // as per jackson 2.9 /* /********************************************************** /* Life-cycle: constructors /********************************************************** */ /** * @param builder Builder object that contains collected information * that may be needed for serializer * @param properties Property writers used for actual serialization */ public BeanSerializer(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(type, builder, properties, filteredProperties); } /** * Alternate copy constructor that can be used to construct * standard {@link BeanSerializer} passing an instance of * "compatible enough" source serializer. */ protected BeanSerializer(BeanSerializerBase src) { super(src); } protected BeanSerializer(BeanSerializerBase src, ObjectIdWriter objectIdWriter) { super(src, objectIdWriter); } protected BeanSerializer(BeanSerializerBase src, ObjectIdWriter objectIdWriter, Object filterId) { super(src, objectIdWriter, filterId); } protected BeanSerializer(BeanSerializerBase src, Set<String> toIgnore, Set<String> toInclude) { super(src, toIgnore, toInclude); } // @since 2.11.1 protected BeanSerializer(BeanSerializerBase src, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { super(src, properties, filteredProperties); } /* /********************************************************** /* Life-cycle: factory methods, fluent factories /********************************************************** */ /** * @deprecated Since 2.10 */ @Deprecated public static BeanSerializer createDummy(JavaType forType) { return new BeanSerializer(forType, null, NO_PROPS, null); } /** * Method for constructing dummy bean serializer; one that * never outputs any properties * * @since 2.10 */ public static BeanSerializer createDummy(JavaType forType, BeanSerializerBuilder builder) { return new BeanSerializer(forType, builder, NO_PROPS, null); } @Override public JsonSerializer<Object> unwrappingSerializer(NameTransformer unwrapper) { return new UnwrappingBeanSerializer(this, unwrapper); } @Override public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) { return new BeanSerializer(this, objectIdWriter, _propertyFilterId); } @Override public BeanSerializerBase withFilterId(Object filterId) { return new BeanSerializer(this, _objectIdWriter, filterId); } @Override // @since 2.12 protected BeanSerializerBase withByNameInclusion(Set<String> toIgnore, Set<String> toInclude) { return new BeanSerializer(this, toIgnore, toInclude); } @Override // @since 2.11.1 protected BeanSerializerBase withProperties(BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) { return new BeanSerializer(this, properties, filteredProperties); } /** * Implementation has to check whether as-array serialization * is possible reliably; if (and only if) so, will construct * a {@link BeanAsArraySerializer}, otherwise will return this * serializer as is. */ @Override protected BeanSerializerBase asArraySerializer() { /* Cannot: * * - have Object Id (may be allowed in future) * - have "any getter" * - have per-property filters */ if ((_objectIdWriter == null) && (_anyGetterWriter == null) && (_propertyFilterId == null) ) { return new BeanAsArraySerializer(this); } // already is one, so: return this; } /* /********************************************************** /* JsonSerializer implementation that differs between impls /********************************************************** */ /** * Main serialization method that will delegate actual output to * configured * {@link BeanPropertyWriter} instances. */ @Override public final void serialize(Object bean, JsonGenerator gen, SerializerProvider provider) throws IOException { if (_objectIdWriter != null) { gen.setCurrentValue(bean); // [databind#631] _serializeWithObjectId(bean, gen, provider, true); return; } gen.writeStartObject(bean); if (_propertyFilterId != null) { serializeFieldsFiltered(bean, gen, provider); } else { serializeFields(bean, gen, provider); } gen.writeEndObject(); } /* /********************************************************** /* Standard methods /********************************************************** */ @Override public String toString() { return "BeanSerializer for "+handledType().getName(); } }
⏎ com/fasterxml/jackson/databind/ser/BeanSerializer.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, 80869👍, 0💬
Popular Posts:
JDK 11 jdk.jshell.jmod is the JMOD file for JDK 11 JShell tool, which can be invoked by the "jshell"...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
What Is poi-scratchpad-5.2.3.jar ?poi-scratchpad-5.2.3.jar is one of the JAR files for Apache POI 5....
Provides a simple high-level Http server API, which can be used to build embedded HTTP servers. Both...
What Is poi-scratchpad-3.5.jar? poi-scratchpad-3.5.jar is one of the JAR files for Apache POI 3.5, w...