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/DoubleNode.java
package com.fasterxml.jackson.databind.node;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.io.NumberOutput;
import com.fasterxml.jackson.databind.SerializerProvider;
/**
* Numeric node that contains 64-bit ("double precision")
* floating point values simple 32-bit integer values.
*/
@SuppressWarnings("serial")
public class DoubleNode
extends NumericNode
{
protected final double _value;
/*
/**********************************************************
/* Construction
/**********************************************************
*/
public DoubleNode(double v) { _value = v; }
public static DoubleNode valueOf(double v) { return new DoubleNode(v); }
/*
/**********************************************************
/* BaseJsonNode extended API
/**********************************************************
*/
@Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_FLOAT; }
@Override
public JsonParser.NumberType numberType() { return JsonParser.NumberType.DOUBLE; }
/*
/**********************************************************
/* Overrridden JsonNode methods
/**********************************************************
*/
@Override
public boolean isFloatingPointNumber() { return true; }
@Override
public boolean isDouble() { return true; }
@Override public boolean canConvertToInt() {
return (_value >= Integer.MIN_VALUE && _value <= Integer.MAX_VALUE);
}
@Override public boolean canConvertToLong() {
return (_value >= Long.MIN_VALUE && _value <= Long.MAX_VALUE);
}
@Override // since 2.12
public boolean canConvertToExactIntegral() {
return !Double.isNaN(_value) && !Double.isInfinite(_value)
&& (_value == Math.rint(_value));
}
@Override
public Number numberValue() {
return Double.valueOf(_value);
}
@Override
public short shortValue() { return (short) _value; }
@Override
public int intValue() { return (int) _value; }
@Override
public long longValue() { return (long) _value; }
@Override
public float floatValue() { return (float) _value; }
@Override
public double doubleValue() { return _value; }
@Override
public BigDecimal decimalValue() { return BigDecimal.valueOf(_value); }
@Override
public BigInteger bigIntegerValue() {
return decimalValue().toBigInteger();
}
@Override
public String asText() {
return NumberOutput.toString(_value);
}
// @since 2.9
@Override
public boolean isNaN() {
return Double.isNaN(_value) || Double.isInfinite(_value);
}
@Override
public final void serialize(JsonGenerator g, SerializerProvider provider) throws IOException {
g.writeNumber(_value);
}
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o instanceof DoubleNode) {
// We must account for NaNs: NaN does not equal NaN, therefore we have
// to use Double.compare().
final double otherValue = ((DoubleNode) o)._value;
return Double.compare(_value, otherValue) == 0;
}
return false;
}
@Override
public int hashCode()
{
// same as hashCode Double.class uses
long l = Double.doubleToLongBits(_value);
return ((int) l) ^ (int) (l >> 32);
}
}
⏎ com/fasterxml/jackson/databind/node/DoubleNode.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, ≈181🔥, 0💬
Popular Posts:
What is the jaxp\TypeInfoWriter.java provided in the Apache Xerces package? I have Apache Xerces 2.1...
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...
JDK 11 jdk.hotspot.agent.jmod is the JMOD file for JDK 11 Hotspot Agent module. JDK 11 Hotspot Agent...
JDK 11 jdk.internal.opt.jmod is the JMOD file for JDK 11 Internal Opt module. JDK 11 Internal Opt mo...
How to download and install JDK (Java Development Kit) 7? If you want to write Java applications, yo...