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/FloatNode.java
package com.fasterxml.jackson.databind.node; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.io.NumberOutput; import com.fasterxml.jackson.databind.SerializerProvider; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; /** * <code>JsonNode</code> implementation for efficiently containing 32-bit * `float` values. * * @since 2.2 */ @SuppressWarnings("serial") public class FloatNode extends NumericNode { protected final float _value; /* /********************************************************** /* Construction /********************************************************** */ public FloatNode(float v) { _value = v; } public static FloatNode valueOf(float v) { return new FloatNode(v); } /* /********************************************************** /* BaseJsonNode extended API /********************************************************** */ @Override public JsonToken asToken() { return JsonToken.VALUE_NUMBER_FLOAT; } @Override public JsonParser.NumberType numberType() { return JsonParser.NumberType.FLOAT; } /* /********************************************************** /* Overrridden JsonNode methods /********************************************************** */ @Override public boolean isFloatingPointNumber() { return true; } @Override public boolean isFloat() { 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 !Float.isNaN(_value) && !Float.isInfinite(_value) && (_value == Math.round(_value)); } @Override public Number numberValue() { return Float.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 _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() { // Java 8 will have `Float.isFinite()` to combine both checks return Float.isNaN(_value) || Float.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 FloatNode) { // We must account for NaNs: NaN does not equal NaN, therefore we have // to use Double.compare(). final float otherValue = ((FloatNode) o)._value; return Float.compare(_value, otherValue) == 0; } return false; } @Override public int hashCode() { return Float.floatToIntBits(_value); } }
⏎ com/fasterxml/jackson/databind/node/FloatNode.java
Â
⇒ Jackson Annotations Source Code
⇠Download and Install Jackson Binary Package
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-03-29, 32096👍, 0💬
Popular Posts:
XMLSchema, Release 1.4.2, is a lightweight Java object model that can be used to manipulate and gene...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...
The SOAP with Attachments API for JavaTM (SAAJ) 1.3 provides the API for creating and sending SOAP m...
How to read XML document with DTD validation from socket connections with the socket\DelayedInput.ja.. .
commons-collections4-4.2 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...