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 Annotations Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Annotations Source Code files are provided in the source packge (jackson-annotations-2.12.4-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Annotations Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/ser/std/EnumSetSerializer.java
package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; import java.util.*; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; @SuppressWarnings("serial") public class EnumSetSerializer extends AsArraySerializerBase<EnumSet<? extends Enum<?>>> { /** * @since 2.6 */ public EnumSetSerializer(JavaType elemType) { super(EnumSet.class, elemType, true, null, null); } public EnumSetSerializer(EnumSetSerializer src, BeanProperty property, TypeSerializer vts, JsonSerializer<?> valueSerializer, Boolean unwrapSingle) { super(src, property, vts, valueSerializer, unwrapSingle); } @Override public EnumSetSerializer _withValueTypeSerializer(TypeSerializer vts) { // no typing for enums (always "hard" type) return this; } @Override public EnumSetSerializer withResolved(BeanProperty property, TypeSerializer vts, JsonSerializer<?> elementSerializer, Boolean unwrapSingle) { return new EnumSetSerializer(this, property, vts, elementSerializer, unwrapSingle); } @Override public boolean isEmpty(SerializerProvider prov, EnumSet<? extends Enum<?>> value) { return value.isEmpty(); } @Override public boolean hasSingleElement(EnumSet<? extends Enum<?>> value) { return value.size() == 1; } @Override public final void serialize(EnumSet<? extends Enum<?>> value, JsonGenerator gen, SerializerProvider provider) throws IOException { final int len = value.size(); if (len == 1) { if (((_unwrapSingle == null) && provider.isEnabled(SerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED)) || (_unwrapSingle == Boolean.TRUE)) { serializeContents(value, gen, provider); return; } } gen.writeStartArray(value, len); serializeContents(value, gen, provider); gen.writeEndArray(); } @Override public void serializeContents(EnumSet<? extends Enum<?>> value, JsonGenerator gen, SerializerProvider provider) throws IOException { JsonSerializer<Object> enumSer = _elementSerializer; /* Need to dynamically find instance serializer; unfortunately * that seems to be the only way to figure out type (no accessors * to the enum class that set knows) */ for (Enum<?> en : value) { if (enumSer == null) { // 12-Jan-2010, tatu: Since enums cannot be polymorphic, let's // not bother with typed serializer variant here enumSer = provider.findContentValueSerializer(en.getDeclaringClass(), _property); } enumSer.serialize(en, gen, provider); } } }
⏎ com/fasterxml/jackson/databind/ser/std/EnumSetSerializer.java
Â
⇒ Jackson Dataformat Extensions
⇠Jackson Data Binding Source Code
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-02-19, 36271👍, 0💬
Popular Posts:
What Is xercesImpl.jar in Xerces Java 2.11.0? xercesImpl.jar in Xerces Java 2.11.0 is the JAR file f...
MXP1 is a stable XmlPull parsing engine that is based on ideas from XPP and in particular XPP2 but c...
What Is mail.jar of JavaMail 1.4.2? I got the JAR file from javamail-1.4.2.zip. mail.jar in javamail...
How to perform XML Schema validation with sax\Writer.java provided in the Apache Xerces package? You...
JasperReports, the world's most popular open source business intelligence and reporting engine and J...