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 Data Binding Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Databind Source Code files are provided in the source packge (jackson-databind-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Databind Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/node/POJONode.java
package com.fasterxml.jackson.databind.node;
import java.io.IOException;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.JsonSerializable;
import com.fasterxml.jackson.databind.SerializerProvider;
/**
* Value node that contains a wrapped POJO, to be serialized as
* a JSON constructed through data mapping (usually done by
* calling {@link com.fasterxml.jackson.databind.ObjectMapper}).
*/
public class POJONode
extends ValueNode
{
private static final long serialVersionUID = 2L;
protected final Object _value;
public POJONode(Object v) { _value = v; }
/*
/**********************************************************
/* Base class overrides
/**********************************************************
*/
@Override
public JsonNodeType getNodeType() {
return JsonNodeType.POJO;
}
@Override public JsonToken asToken() { return JsonToken.VALUE_EMBEDDED_OBJECT; }
/**
* As it is possible that some implementations embed byte[] as POJONode
* (despite optimal being {@link BinaryNode}), let's add support for exposing
* binary data here too.
*/
@Override
public byte[] binaryValue() throws IOException
{
if (_value instanceof byte[]) {
return (byte[]) _value;
}
return super.binaryValue();
}
/*
/**********************************************************
/* General type coercions
/**********************************************************
*/
@Override
public String asText() { return (_value == null) ? "null" : _value.toString(); }
@Override public String asText(String defaultValue) {
return (_value == null) ? defaultValue : _value.toString();
}
@Override
public boolean asBoolean(boolean defaultValue)
{
if (_value != null && _value instanceof Boolean) {
return ((Boolean) _value).booleanValue();
}
return defaultValue;
}
@Override
public int asInt(int defaultValue)
{
if (_value instanceof Number) {
return ((Number) _value).intValue();
}
return defaultValue;
}
@Override
public long asLong(long defaultValue)
{
if (_value instanceof Number) {
return ((Number) _value).longValue();
}
return defaultValue;
}
@Override
public double asDouble(double defaultValue)
{
if (_value instanceof Number) {
return ((Number) _value).doubleValue();
}
return defaultValue;
}
/*
/**********************************************************
/* Public API, serialization
/**********************************************************
*/
@Override
public final void serialize(JsonGenerator gen, SerializerProvider ctxt) throws IOException
{
if (_value == null) {
ctxt.defaultSerializeNull(gen);
} else if (_value instanceof JsonSerializable) {
((JsonSerializable) _value).serialize(gen, ctxt);
} else {
// 25-May-2018, tatu: [databind#1991] do not call via generator but through context;
// this to preserve contextual information
ctxt.defaultSerializeValue(_value, gen);
}
}
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
/**
* Method that can be used to access the POJO this node wraps.
*/
public Object getPojo() { return _value; }
/*
/**********************************************************
/* Overridden standard methods
/**********************************************************
*/
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o instanceof POJONode) {
return _pojoEquals((POJONode) o);
}
return false;
}
/**
* @since 2.3
*/
protected boolean _pojoEquals(POJONode other)
{
if (_value == null) {
return other._value == null;
}
return _value.equals(other._value);
}
@Override
public int hashCode() { return _value.hashCode(); }
}
⏎ com/fasterxml/jackson/databind/node/POJONode.java
Or download all of them as a single archive file:
File name: jackson-databind-2.14.0-sources.jar File size: 1187952 bytes Release date: 2022-11-05 Download
⇒ Jackson Annotations Source Code
⇐ Download and Install Jackson Binary Package
2022-03-29, ≈200🔥, 0💬
Popular Posts:
How to download and install ojdbc6.jar for Oracle 11g R2? ojdbc6.jar for Oracle 11g R2 is a Java 6, ...
JDK 17 jdk.xml.dom.jmod is the JMOD file for JDK 17 XML DOM module. JDK 17 XML DOM module compiled c...
HttpComponents Core Source Code Files are provided in the source package file, httpcomponents-core-5...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...