@@ -819,9 +819,40 @@ public int getText(Writer writer) throws IOException, UnsupportedOperationExcept
819
819
* all kinds of numeric values. It will return the optimal
820
820
* (simplest/smallest possible) wrapper object that can
821
821
* express the numeric value just parsed.
822
+ *
823
+ * @return Numeric value of the current token in its most optimal
824
+ * representation
825
+ *
826
+ * @throws IOException Problem with access: {@link JsonParseException} if
827
+ * the current token is not numeric, or if decoding of the value fails
828
+ * (invalid format for numbers); plain {@link IOException} if underlying
829
+ * content read fails (possible if values are extracted lazily)
822
830
*/
823
831
public abstract Number getNumberValue () throws IOException ;
824
832
833
+ /**
834
+ * Method similar to {@link #getNumberValue} with the difference that
835
+ * for floating-point numbers value returned may be {@link BigDecimal}
836
+ * if the underlying format does not store floating-point numbers using
837
+ * native representation: for example, textual formats represent numbers
838
+ * as Strings (which are 10-based), and conversion to {@link java.lang.Double}
839
+ * is potentially lossy operation.
840
+ *<p>
841
+ * Default implementation simply returns {@link #getNumberValue()}
842
+ *
843
+ * @return Numeric value of the current token using most accurate representation
844
+ *
845
+ * @throws IOException Problem with access: {@link JsonParseException} if
846
+ * the current token is not numeric, or if decoding of the value fails
847
+ * (invalid format for numbers); plain {@link IOException} if underlying
848
+ * content read fails (possible if values are extracted lazily)
849
+ *
850
+ * @since 2.12
851
+ */
852
+ public Number getNumberValueExact () throws IOException {
853
+ return getNumberValue ();
854
+ }
855
+
825
856
/**
826
857
* If current token is of type
827
858
* {@link JsonToken#VALUE_NUMBER_INT} or
0 commit comments