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/ext/CoreXMLSerializers.java
package com.fasterxml.jackson.databind.ext; import java.io.IOException; import java.util.Calendar; import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.Serializers; import com.fasterxml.jackson.databind.ser.std.CalendarSerializer; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; /** * Provider for serializers of XML types that are part of full JDK 1.5, but * that some alleged 1.5 platforms are missing (Android, GAE). * And for this reason these are added using more dynamic mechanism. *<p> * Note: since many of classes defined are abstract, caller must take * care not to just use straight equivalency check but rather consider * subclassing as well. */ public class CoreXMLSerializers extends Serializers.Base { @Override public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) { Class<?> raw = type.getRawClass(); if (Duration.class.isAssignableFrom(raw) || QName.class.isAssignableFrom(raw)) { return ToStringSerializer.instance; } if (XMLGregorianCalendar.class.isAssignableFrom(raw)) { return XMLGregorianCalendarSerializer.instance; } return null; } @SuppressWarnings("serial") public static class XMLGregorianCalendarSerializer extends StdSerializer<XMLGregorianCalendar> implements ContextualSerializer { final static XMLGregorianCalendarSerializer instance = new XMLGregorianCalendarSerializer(); final JsonSerializer<Object> _delegate; public XMLGregorianCalendarSerializer() { this(CalendarSerializer.instance); } @SuppressWarnings("unchecked") protected XMLGregorianCalendarSerializer(JsonSerializer<?> del) { super(XMLGregorianCalendar.class); _delegate = (JsonSerializer<Object>) del; } @Override public JsonSerializer<?> getDelegatee() { return _delegate; } @Override public boolean isEmpty(SerializerProvider provider, XMLGregorianCalendar value) { return _delegate.isEmpty(provider, _convert(value)); } @Override public void serialize(XMLGregorianCalendar value, JsonGenerator gen, SerializerProvider provider) throws IOException { _delegate.serialize(_convert(value), gen, provider); } @Override public void serializeWithType(XMLGregorianCalendar value, JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException { // 16-Aug-2021, tatu: as per [databind#3217] we cannot simply delegate // as that would produce wrong Type Id altogether. So redefine // implementation from `StdScalarSerializer` // _delegate.serializeWithType(_convert(value), gen, provider, typeSer); // Need not really be string; just indicates "scalar of some kind" // (and so numeric timestamp is fine as well): WritableTypeId typeIdDef = typeSer.writeTypePrefix(g, // important! Pass value AND type to use typeSer.typeId(value, XMLGregorianCalendar.class, JsonToken.VALUE_STRING)); // note: serialize() will convert to delegate value serialize(value, g, provider); typeSer.writeTypeSuffix(g, typeIdDef); } @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { _delegate.acceptJsonFormatVisitor(visitor, null); } @Override public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException { JsonSerializer<?> ser = prov.handlePrimaryContextualization(_delegate, property); if (ser != _delegate) { return new XMLGregorianCalendarSerializer(ser); } return this; } protected Calendar _convert(XMLGregorianCalendar input) { return (input == null) ? null : input.toGregorianCalendar(); } } }
⏎ com/fasterxml/jackson/databind/ext/CoreXMLSerializers.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, 109329👍, 0💬
Popular Posts:
The Web Services Description Language for Java Toolkit (WSDL4J), Release 1.6.2, allows the creation,...
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...
layout.jar is a component in iText Java library to provide layout functionalities. iText Java librar...
What Is jms.jar? I heard it's related to JMS (Java Message Service) 1.1? The if you have an jms.jar ...
JDK 11 java.sql.jmod is the JMOD file for JDK 11 SQL (Structured Query Language) module. JDK 11 SQL ...