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 Dataformat XML Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson also allows you to parse or generate XML messages with the Jackson Dataformat XML Extension.
Jackson Dataformat XML Source Code files are provided in the source packge (jackson-dataformat-xml-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Dataformat XML Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/dataformat/xml/deser/XmlTextDeserializer.java
package com.fasterxml.jackson.dataformat.xml.deser;
import java.io.IOException;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.*;
import com.fasterxml.jackson.databind.deser.std.DelegatingDeserializer;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
/**
* Delegating deserializer that is used in the special cases where
* we may sometimes see a "plain" String value but need to map it
* as if it was a property of POJO. The impedance is introduced by
* heuristic conversion from XML events into rough JSON equivalents;
* and this is one work-around that can only be done after the fact.
*/
public class XmlTextDeserializer
extends DelegatingDeserializer
{
private static final long serialVersionUID = 1L;
/**
* Property index of the "XML text property"; needed for finding actual
* property instance after resolution and contextualization: instance
* may change, but index will remain constant.
*/
protected final int _xmlTextPropertyIndex;
/**
* Actual property that is indicated to be of type "XML Text" (and
* is the only element-valued property)
*/
protected final SettableBeanProperty _xmlTextProperty;
protected final ValueInstantiator _valueInstantiator;
/*
/**********************************************************************
/* Construction
/**********************************************************************
*/
public XmlTextDeserializer(BeanDeserializerBase delegate, SettableBeanProperty prop)
{
super(delegate);
_xmlTextProperty = prop;
_xmlTextPropertyIndex = prop.getPropertyIndex();
_valueInstantiator = delegate.getValueInstantiator();
}
public XmlTextDeserializer(BeanDeserializerBase delegate, int textPropIndex)
{
super(delegate);
_xmlTextPropertyIndex = textPropIndex;
_valueInstantiator = delegate.getValueInstantiator();
_xmlTextProperty = delegate.findProperty(textPropIndex);
}
/*
/**********************************************************************
/* Abstract method implementations
/**********************************************************************
*/
@Override
protected JsonDeserializer<?> newDelegatingInstance(JsonDeserializer<?> newDelegatee0) {
// default not enough, as we need to create a new wrapping deserializer
// even if delegatee does not change
throw new IllegalStateException("Internal error: should never get called");
}
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
BeanProperty property)
throws JsonMappingException
{
return new XmlTextDeserializer(_verifyDeserType(_delegatee), _xmlTextPropertyIndex);
}
/*
/**********************************************************************
/* Overridden deserialization methods
/**********************************************************************
*/
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException
{
if (p.getCurrentToken() == JsonToken.VALUE_STRING) {
Object bean = _valueInstantiator.createUsingDefault(ctxt);
_xmlTextProperty.deserializeAndSet(p, ctxt, bean);
return bean;
}
return _delegatee.deserialize(p, ctxt);
}
@SuppressWarnings("unchecked")
@Override
public Object deserialize(JsonParser p, DeserializationContext ctxt,
Object bean) throws IOException
{
if (p.getCurrentToken() == JsonToken.VALUE_STRING) {
_xmlTextProperty.deserializeAndSet(p, ctxt, bean);
return bean;
}
return ((JsonDeserializer<Object>)_delegatee).deserialize(p, ctxt, bean);
}
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
throws IOException
{
return _delegatee.deserializeWithType(p, ctxt, typeDeserializer);
}
/*
/**********************************************************************
/* Internal methods
/**********************************************************************
*/
protected BeanDeserializerBase _verifyDeserType(JsonDeserializer<?> deser)
{
if (!(deser instanceof BeanDeserializerBase)) {
throw new IllegalArgumentException("Can not change delegate to be of type "
+deser.getClass().getName());
}
return (BeanDeserializerBase) deser;
}
}
⏎ com/fasterxml/jackson/dataformat/xml/deser/XmlTextDeserializer.java
Or download all of them as a single archive file:
File name: jackson-dataformat-xml-2.14.0-sources.jar File size: 98015 bytes Release date: 2022-11-05 Download
⇒ Download Jackson Dataformat Binary Packages
⇐ Jackson Dataformat Extensions
2021-10-10, ≈23🔥, 0💬
Popular Posts:
JDK 17 jdk.hotspot.agent.jmod is the JMOD file for JDK 17 Hotspot Agent module. JDK 17 Hotspot Agent...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...
commons-collections4-4.4 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...
What JAR files are required to run dom\Counter.java provided in the Apache Xerces package? You can f...