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/AnyGetterWriter.java
package com.fasterxml.jackson.databind.ser; import java.util.Map; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.ser.std.MapSerializer; /** * Class similar to {@link BeanPropertyWriter}, but that will be used * for serializing {@link com.fasterxml.jackson.annotation.JsonAnyGetter} annotated * (Map) properties */ public class AnyGetterWriter { protected final BeanProperty _property; /** * Method (or field) that represents the "any getter" */ protected final AnnotatedMember _accessor; protected JsonSerializer<Object> _serializer; protected MapSerializer _mapSerializer; @SuppressWarnings("unchecked") public AnyGetterWriter(BeanProperty property, AnnotatedMember accessor, JsonSerializer<?> serializer) { _accessor = accessor; _property = property; _serializer = (JsonSerializer<Object>) serializer; if (serializer instanceof MapSerializer) { _mapSerializer = (MapSerializer) serializer; } } /** * @since 2.8.3 */ public void fixAccess(SerializationConfig config) { _accessor.fixAccess( config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } public void getAndSerialize(Object bean, JsonGenerator gen, SerializerProvider provider) throws Exception { Object value = _accessor.getValue(bean); if (value == null) { return; } if (!(value instanceof Map<?,?>)) { provider.reportBadDefinition(_property.getType(), String.format( "Value returned by 'any-getter' %s() not java.util.Map but %s", _accessor.getName(), value.getClass().getName())); } // 23-Feb-2015, tatu: Nasty, but has to do (for now) if (_mapSerializer != null) { _mapSerializer.serializeWithoutTypeInfo((Map<?,?>) value, gen, provider); return; } _serializer.serialize(value, gen, provider); } /** * @since 2.3 */ public void getAndFilter(Object bean, JsonGenerator gen, SerializerProvider provider, PropertyFilter filter) throws Exception { Object value = _accessor.getValue(bean); if (value == null) { return; } if (!(value instanceof Map<?,?>)) { provider.reportBadDefinition(_property.getType(), String.format("Value returned by 'any-getter' (%s()) not java.util.Map but %s", _accessor.getName(), value.getClass().getName())); } // 19-Oct-2014, tatu: Should we try to support @JsonInclude options here? if (_mapSerializer != null) { _mapSerializer.serializeFilteredAnyProperties(provider, gen, bean,(Map<?,?>) value, filter, null); return; } // ... not sure how custom handler would do it _serializer.serialize(value, gen, provider); } // Note: NOT part of ResolvableSerializer... @SuppressWarnings("unchecked") public void resolve(SerializerProvider provider) throws JsonMappingException { // 05-Sep-2013, tatu: I _think_ this can be considered a primary property... if (_serializer instanceof ContextualSerializer) { JsonSerializer<?> ser = provider.handlePrimaryContextualization(_serializer, _property); _serializer = (JsonSerializer<Object>) ser; if (ser instanceof MapSerializer) { _mapSerializer = (MapSerializer) ser; } } } }
⏎ com/fasterxml/jackson/databind/ser/AnyGetterWriter.java
Â
⇒ Jackson Dataformat Extensions
⇠Jackson Data Binding Source Code
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-02-19, 36354👍, 0💬
Popular Posts:
JDK 11 jdk.internal.JVM Stat.jmod is the JMOD file for JDK 11 Internal Jvmstat module. JDK 11 Intern...
How to read XML document with XML Schema validation from socket connections with the socket\DelayedI...
XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with ...
What Is poi-ooxml-3.5.jar? poi-ooxml-3.5.jar is one of the JAR files for Apache POI 3.5, which provi...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...