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 JAXB Annotations Source Code
Jackson JAXB Annotations Source Code files are provided in the source packge (jackson-module-jaxb-annotations-2.14.0-sources.jar). You can download it at Jackson Base module Maven Website.
You can also browse Jackson JAXB Annotations Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/module/jaxb/deser/DomElementJsonDeserializer.java
package com.fasterxml.jackson.module.jaxb.deser; import java.io.IOException; import java.util.Iterator; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.node.ArrayNode; /** * @author Ryan Heaton * * @deprecated Since 2.10 not used */ @Deprecated // since 2.10 -- not used anywhere? public class DomElementJsonDeserializer extends StdDeserializer<Element> { private static final long serialVersionUID = 1L; private final DocumentBuilder builder; public DomElementJsonDeserializer() { super(Element.class); try { DocumentBuilderFactory bf = DocumentBuilderFactory.newInstance(); bf.setNamespaceAware(true); // [modules-base#84]: add secure processing settings bf.setExpandEntityReferences(false); builder = bf.newDocumentBuilder(); try { bf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch(Exception e) { // not necessarily supported by all implementations } } catch (ParserConfigurationException e) { throw new RuntimeException(); } } public DomElementJsonDeserializer(DocumentBuilder b) { super(Element.class); builder = b; } @Override public Element deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { Document document = builder.newDocument(); JsonNode n = p.readValueAsTree(); return fromNode(p, document, n); } protected Element fromNode(JsonParser p, Document document, JsonNode jsonNode) throws IOException { String ns = jsonNode.get("namespace") != null ? jsonNode.get("namespace").asText() : null; String name = jsonNode.get("name") != null ? jsonNode.get("name").asText() : null; if (name == null) { throw JsonMappingException.from(p, "No name for DOM element was provided in the JSON object."); } Element element = document.createElementNS(ns, name); JsonNode attributesNode = jsonNode.get("attributes"); if (attributesNode != null && attributesNode instanceof ArrayNode) { Iterator<JsonNode> atts = attributesNode.elements(); while (atts.hasNext()) { JsonNode node = atts.next(); ns = node.get("namespace") != null ? node.get("namespace").asText() : null; name = node.get("name") != null ? node.get("name").asText() : null; String value = node.get("$") != null ? node.get("$").asText() : null; if (name != null) { element.setAttributeNS(ns, name, value); } } } JsonNode childsNode = jsonNode.get("children"); if (childsNode != null && childsNode instanceof ArrayNode) { Iterator<JsonNode> els = childsNode.elements(); while (els.hasNext()) { JsonNode node = els.next(); name = node.get("name") != null ? node.get("name").asText() : null; String value = node.get("$") != null ? node.get("$").asText() : null; if (value != null) { element.appendChild(document.createTextNode(value)); } else if (name != null) { element.appendChild(fromNode(p, document, node)); } } } return element; } }
⏎ com/fasterxml/jackson/module/jaxb/deser/DomElementJsonDeserializer.java
Or download all of them as a single archive file:
File name: jackson-module-jaxb-annotations-2.14.0-sources.jar File size: 27411 bytes Release date: 2022-11-05 Download
⇒ jackson-core-2.2.3.jar - Jackson
2022-05-03, 3636👍, 1💬
Popular Posts:
JDK 11 jdk.internal.vm.ci.jmod is the JMOD file for JDK 11 Internal VM CI module. JDK 11 Internal VM...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...
What Is javamail-1_2.zip? javamail-1_2.zip is the binary package of JavaMail API 1.2 in ZIP format. ...
Apache Log4j 1.2 Bridge allows applications coded to use Log4j 1.2 API to use Log4j 2 instead. Bytec...
How to download and install mysql-connector-j-8.0.31 .zip?Connector/J Java library is a JDBC Driver ...