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/std/ArraySerializerBase.java
package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.*; /** * Intermediate base class for serializers used for various * Java arrays. * * @param <T> Type of arrays serializer handles */ @SuppressWarnings("serial") public abstract class ArraySerializerBase<T> extends ContainerSerializer<T> implements ContextualSerializer // for 'unwrapSingleElemArray' { protected final BeanProperty _property; /** * Setting for specific local override for "unwrap single element arrays": * true for enable unwrapping, false for preventing it, `null` for using * global configuration. * * @since 2.6 */ protected final Boolean _unwrapSingle; protected ArraySerializerBase(Class<T> cls) { super(cls); _property = null; _unwrapSingle = null; } /** * Use either variant that just takes type (non-contextual), or, * copy constructor that allows passing of property. * * @deprecated Since 2.6 */ @Deprecated protected ArraySerializerBase(Class<T> cls, BeanProperty property) { super(cls); _property = property; _unwrapSingle = null; } protected ArraySerializerBase(ArraySerializerBase<?> src) { super(src._handledType, false); _property = src._property; _unwrapSingle = src._unwrapSingle; } /** * @since 2.6 */ protected ArraySerializerBase(ArraySerializerBase<?> src, BeanProperty property, Boolean unwrapSingle) { super(src._handledType, false); _property = property; _unwrapSingle = unwrapSingle; } /** * @deprecated Since 2.6 */ @Deprecated protected ArraySerializerBase(ArraySerializerBase<?> src, BeanProperty property) { super(src._handledType, false); _property = property; _unwrapSingle = src._unwrapSingle; } /** * @since 2.6 */ public abstract JsonSerializer<?> _withResolved(BeanProperty prop, Boolean unwrapSingle); @Override public JsonSerializer<?> createContextual(SerializerProvider serializers, BeanProperty property) throws JsonMappingException { Boolean unwrapSingle = null; // First: if we have a property, may have property-annotation overrides if (property != null) { JsonFormat.Value format = findFormatOverrides(serializers, property, handledType()); if (format != null) { unwrapSingle = format.getFeature(JsonFormat.Feature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED); if (!Objects.equals(unwrapSingle, _unwrapSingle)) { return _withResolved(property, unwrapSingle); } } } return this; } // NOTE: as of 2.5, sub-classes SHOULD override (in 2.4 and before, was final), // at least if they can provide access to actual size of value and use `writeStartArray()` // variant that passes size of array to output, which is helpful with some data formats @Override public void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws IOException { if (_shouldUnwrapSingle(provider)) { if (hasSingleElement(value)) { serializeContents(value, gen, provider); return; } } gen.writeStartArray(value); serializeContents(value, gen, provider); gen.writeEndArray(); } @Override public final void serializeWithType(T value, JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException { WritableTypeId typeIdDef = typeSer.writeTypePrefix(g, typeSer.typeId(value, JsonToken.START_ARRAY)); // [databind#631]: Assign current value, to be accessible by custom serializers g.setCurrentValue(value); serializeContents(value, g, provider); typeSer.writeTypeSuffix(g, typeIdDef); } protected abstract void serializeContents(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException; /** * @since 2.9 */ protected final boolean _shouldUnwrapSingle(SerializerProvider provider) { if (_unwrapSingle == null) { return provider.isEnabled(SerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED); } return _unwrapSingle.booleanValue(); } }
⏎ com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.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, 48258👍, 0💬
Popular Posts:
How to download and install JDK (Java Development Kit) 6? If you want to write Java applications, yo...
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
JRE 8 plugin.jar is the JAR file for JRE 8 Java Control Panel Plugin interface and tools. JRE (Java ...
JDK 11 jrt-fs.jar is the JAR file for JDK 11 JRT-FS (Java RunTime - File System) defined in the "jdk...
commons-collections4-4.4 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...