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/deser/impl/FieldProperty.java
package com.fasterxml.jackson.databind.deser.impl; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.NullValueProvider; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.introspect.AnnotatedField; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.Annotations; import com.fasterxml.jackson.databind.util.ClassUtil; /** * This concrete sub-class implements property that is set * directly assigning to a Field. */ public final class FieldProperty extends SettableBeanProperty { private static final long serialVersionUID = 1L; final protected AnnotatedField _annotated; /** * Actual field to set when deserializing this property. * Transient since there is no need to persist; only needed during * construction of objects. */ final protected transient Field _field; /** * @since 2.9 */ final protected boolean _skipNulls; public FieldProperty(BeanPropertyDefinition propDef, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations, AnnotatedField field) { super(propDef, type, typeDeser, contextAnnotations); _annotated = field; _field = field.getAnnotated(); _skipNulls = NullsConstantProvider.isSkipper(_nullProvider); } protected FieldProperty(FieldProperty src, JsonDeserializer<?> deser, NullValueProvider nva) { super(src, deser, nva); _annotated = src._annotated; _field = src._field; _skipNulls = NullsConstantProvider.isSkipper(nva); } protected FieldProperty(FieldProperty src, PropertyName newName) { super(src, newName); _annotated = src._annotated; _field = src._field; _skipNulls = src._skipNulls; } /** * Constructor used for JDK Serialization when reading persisted object */ protected FieldProperty(FieldProperty src) { super(src); _annotated = src._annotated; Field f = _annotated.getAnnotated(); if (f == null) { throw new IllegalArgumentException("Missing field (broken JDK (de)serialization?)"); } _field = f; _skipNulls = src._skipNulls; } @Override public SettableBeanProperty withName(PropertyName newName) { return new FieldProperty(this, newName); } @Override public SettableBeanProperty withValueDeserializer(JsonDeserializer<?> deser) { if (_valueDeserializer == deser) { return this; } // 07-May-2019, tatu: As per [databind#2303], must keep VD/NVP in-sync if they were NullValueProvider nvp = (_valueDeserializer == _nullProvider) ? deser : _nullProvider; return new FieldProperty(this, deser, nvp); } @Override public SettableBeanProperty withNullProvider(NullValueProvider nva) { return new FieldProperty(this, _valueDeserializer, nva); } @Override public void fixAccess(DeserializationConfig config) { ClassUtil.checkAndFixAccess(_field, config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } /* /********************************************************** /* BeanProperty impl /********************************************************** */ @Override public <A extends Annotation> A getAnnotation(Class<A> acls) { return (_annotated == null) ? null : _annotated.getAnnotation(acls); } @Override public AnnotatedMember getMember() { return _annotated; } /* /********************************************************** /* Overridden methods /********************************************************** */ @Override public void deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { Object value; if (p.hasToken(JsonToken.VALUE_NULL)) { if (_skipNulls) { return; } value = _nullProvider.getNullValue(ctxt); } else if (_valueTypeDeserializer == null) { value = _valueDeserializer.deserialize(p, ctxt); // 04-May-2018, tatu: [databind#2023] Coercion from String (mostly) can give null if (value == null) { if (_skipNulls) { return; } value = _nullProvider.getNullValue(ctxt); } } else { value = _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer); } try { _field.set(instance, value); } catch (Exception e) { _throwAsIOE(p, e, value); } } @Override public Object deserializeSetAndReturn(JsonParser p, DeserializationContext ctxt, Object instance) throws IOException { Object value; if (p.hasToken(JsonToken.VALUE_NULL)) { if (_skipNulls) { return instance; } value = _nullProvider.getNullValue(ctxt); } else if (_valueTypeDeserializer == null) { value = _valueDeserializer.deserialize(p, ctxt); // 04-May-2018, tatu: [databind#2023] Coercion from String (mostly) can give null if (value == null) { if (_skipNulls) { return instance; } value = _nullProvider.getNullValue(ctxt); } } else { value = _valueDeserializer.deserializeWithType(p, ctxt, _valueTypeDeserializer); } try { _field.set(instance, value); } catch (Exception e) { _throwAsIOE(p, e, value); } return instance; } @Override public void set(Object instance, Object value) throws IOException { try { _field.set(instance, value); } catch (Exception e) { // 15-Sep-2015, tatu: How could we get a ref to JsonParser? _throwAsIOE(e, value); } } @Override public Object setAndReturn(Object instance, Object value) throws IOException { try { _field.set(instance, value); } catch (Exception e) { // 15-Sep-2015, tatu: How could we get a ref to JsonParser? _throwAsIOE(e, value); } return instance; } /* /********************************************************** /* JDK serialization handling /********************************************************** */ Object readResolve() { return new FieldProperty(this); } }
⏎ com/fasterxml/jackson/databind/deser/impl/FieldProperty.java
Â
⇒ Jackson Dataformat Extensions
⇠Jackson Data Binding Source Code
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-02-19, 35539👍, 0💬
Popular Posts:
JDK 11 jdk.hotspot.agent.jmod is the JMOD file for JDK 11 Hotspot Agent module. JDK 11 Hotspot Agent...
JasperReports, the world's most popular open source business intelligence and reporting engine and J...
Apache Log4j IOStreams is a Log4j API extension that provides numerous classes from java.io that can...
JDK 7 tools.jar is the JAR file for JDK 7 tools. It contains Java classes to support different JDK t...
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...