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 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.12.4-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
Â
⇒ Jackson Annotations Source Code
⇠Download and Install Jackson Binary Package
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-03-29, 31697👍, 0💬
Popular Posts:
The JSR 105 XML Digital Signature 1.0.1 FCS implementation provides an API and implementation that a...
How to download and install JDK (Java Development Kit) 8? If you want to write Java applications, yo...
JDK 11 java.base.jmod is the JMOD file for JDK 11 Base module. JDK 11 Base module compiled class fil...
What Is javamail1_1_3.zip? javamail1_1_3.zip is the binary package of JavaMail API 1.1.3 in ZIP form...
What JAR files are required to run dom\Writer.java provided in the Apache Xerces package? 3 JAR file...