File tree 1 file changed +16
-1
lines changed
src/main/java/com/fasterxml/jackson/core
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1769,15 +1769,30 @@ public Object getNumberValueDeferred() throws IOException {
1769
1769
* {@link JsonToken#VALUE_NUMBER_FLOAT}, returns
1770
1770
* one of {@link NumberTypeFP} constants; otherwise returns
1771
1771
* {@link NumberTypeFP#UNKNOWN}.
1772
+ *<p>
1773
+ * Default implementation as of Jackson 2.x will call {@link #getNumberType()}
1774
+ * and translate types -- this needs to be overriden actual implementations
1775
+ * if this is not sufficient (which it usually is not for textual formats).
1772
1776
*
1773
- * @return Type of current number, if parser points to numeric token; {@code null} otherwise
1777
+ * @return Type of current floating-point number, if parser points to numeric token;
1778
+ * {@link NumberTypeFP#UNKNOWN} otherwise.
1774
1779
*
1775
1780
* @throws IOException for low-level read issues, or
1776
1781
* {@link JsonParseException} for decoding problems
1777
1782
*
1778
1783
* @since 2.17
1779
1784
*/
1780
1785
public NumberTypeFP getNumberTypeFP () throws IOException {
1786
+ NumberType nt = getNumberType ();
1787
+ if (nt == NumberType .BIG_DECIMAL ) {
1788
+ return NumberTypeFP .BIG_DECIMAL ;
1789
+ }
1790
+ if (nt == NumberType .DOUBLE ) {
1791
+ return NumberTypeFP .DOUBLE64 ;
1792
+ }
1793
+ if (nt == NumberType .FLOAT ) {
1794
+ return NumberTypeFP .FLOAT32 ;
1795
+ }
1781
1796
return NumberTypeFP .UNKNOWN ;
1782
1797
}
1783
1798
You can’t perform that action at this time.
0 commit comments