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/ser/impl/UnwrappingBeanSerializer.java
package com.fasterxml.jackson.databind.ser.impl;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase;
import com.fasterxml.jackson.databind.util.NameTransformer;
import java.io.IOException;
import java.util.Set;
public class UnwrappingBeanSerializer
extends BeanSerializerBase
implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
/**
* Transformer used to add prefix and/or suffix for properties
* of unwrapped POJO.
*/
protected final NameTransformer _nameTransformer;
/*
/**********************************************************
/* Life-cycle: constructors
/**********************************************************
*/
/**
* Constructor used for creating unwrapping instance of a
* standard <code>BeanSerializer</code>
*/
public UnwrappingBeanSerializer(BeanSerializerBase src, NameTransformer transformer) {
super(src, transformer);
_nameTransformer = transformer;
}
public UnwrappingBeanSerializer(UnwrappingBeanSerializer src,
ObjectIdWriter objectIdWriter) {
super(src, objectIdWriter);
_nameTransformer = src._nameTransformer;
}
public UnwrappingBeanSerializer(UnwrappingBeanSerializer src,
ObjectIdWriter objectIdWriter, Object filterId) {
super(src, objectIdWriter, filterId);
_nameTransformer = src._nameTransformer;
}
protected UnwrappingBeanSerializer(UnwrappingBeanSerializer src, Set<String> toIgnore) {
this(src, toIgnore, null);
}
protected UnwrappingBeanSerializer(UnwrappingBeanSerializer src, Set<String> toIgnore, Set<String> toInclude) {
super(src, toIgnore, toInclude);
_nameTransformer = src._nameTransformer;
}
// @since 2.11.1
protected UnwrappingBeanSerializer(UnwrappingBeanSerializer src,
BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) {
super(src, properties, filteredProperties);
_nameTransformer = src._nameTransformer;
}
/*
/**********************************************************
/* Life-cycle: factory methods, fluent factories
/**********************************************************
*/
@Override
public JsonSerializer<Object> unwrappingSerializer(NameTransformer transformer) {
// !!! 23-Jan-2012, tatu: Should we chain transformers?
return new UnwrappingBeanSerializer(this, transformer);
}
@Override
public boolean isUnwrappingSerializer() {
return true; // sure is
}
@Override
public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) {
return new UnwrappingBeanSerializer(this, objectIdWriter);
}
@Override
public BeanSerializerBase withFilterId(Object filterId) {
return new UnwrappingBeanSerializer(this, _objectIdWriter, filterId);
}
@Override // @since 2.12
protected BeanSerializerBase withByNameInclusion(Set<String> toIgnore, Set<String> toInclude) {
return new UnwrappingBeanSerializer(this, toIgnore, toInclude);
}
@Override // @since 2.11.1
protected BeanSerializerBase withProperties(BeanPropertyWriter[] properties,
BeanPropertyWriter[] filteredProperties) {
return new UnwrappingBeanSerializer(this, properties, filteredProperties);
}
/**
* JSON Array output cannot be done if unwrapping operation is
* requested; so implementation will simply return 'this'.
*/
@Override
protected BeanSerializerBase asArraySerializer() {
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
{
gen.setCurrentValue(bean); // [databind#631]
if (_objectIdWriter != null) {
_serializeWithObjectId(bean, gen, provider, false);
return;
}
if (_propertyFilterId != null) {
serializeFieldsFiltered(bean, gen, provider);
} else {
serializeFields(bean, gen, provider);
}
}
@Override
public void serializeWithType(Object bean, JsonGenerator gen, SerializerProvider provider,
TypeSerializer typeSer) throws IOException
{
if (provider.isEnabled(SerializationFeature.FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS)) {
provider.reportBadDefinition(handledType(),
"Unwrapped property requires use of type information: cannot serialize without disabling `SerializationFeature.FAIL_ON_UNWRAPPED_TYPE_IDENTIFIERS`");
}
gen.setCurrentValue(bean); // [databind#631]
if (_objectIdWriter != null) {
_serializeWithObjectId(bean, gen, provider, typeSer);
return;
}
if (_propertyFilterId != null) {
serializeFieldsFiltered(bean, gen, provider);
} else {
serializeFields(bean, gen, provider);
}
}
/*
/**********************************************************
/* Standard methods
/**********************************************************
*/
@Override public String toString() {
return "UnwrappingBeanSerializer for "+handledType().getName();
}
}
⏎ com/fasterxml/jackson/databind/ser/impl/UnwrappingBeanSerializer.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, ≈175🔥, 0💬
Popular Posts:
How to download and install mysql-connector-j-8.0.31 .zip?Connector/J Java library is a JDBC Driver ...
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
JDK 7 tools.jar is the JAR file for JDK 7 tools. It contains Java classes to support different JDK t...
JDK 1.1 source code directory contains Java source code for JDK 1.1 core classes: "C:\fyicenter\jdk-...
JDK 11 jdk.jfr.jmod is the JMOD file for JDK 11 JFR module. JDK 11 JFR module compiled class files a...