Skip to content

Commit

Permalink
update javadoc to highlight that this class is for internal jackson u…
Browse files Browse the repository at this point in the history
…se (#1156)
  • Loading branch information
pjfanning committed Dec 6, 2023
1 parent ff57898 commit 9e308ea
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/main/java/com/fasterxml/jackson/core/io/BigDecimalParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@
// https://github.com/eobermuhlner/big-math/commit/7a5419aac8b2adba2aa700ccf00197f97b2ad89f

/**
* Helper class used to implement more optimized parsing of {@link BigDecimal} for REALLY
* big values (over 500 characters)
* Internal Jackson Helper class used to implement more optimized parsing of {@link BigDecimal} for REALLY
* big values (over 500 characters).
*<p>
* This class is not meant to be used directly. It is designed to be used by Jackson JSON parsers (and parsers
* for other Jackson supported data formats). The parsers check for invalid characters and the length of the number.
* Without these checks, this parser is susceptible to performing badly with invalid inputs. If you need to parse
* numbers directly, please use JavaBigDecimalParser in <a href="https://github.com/wrandelshofer/FastDoubleParser">fastdoubleparser</a>
* instead.
*</p>
*<p>
* Based on ideas from this
* <a href="https://github.com/eobermuhlner/big-math/commit/7a5419aac8b2adba2aa700ccf00197f97b2ad89f">this
* git commit</a>.
*</p>
*
* @since 2.13
*/
Expand All @@ -27,10 +35,23 @@ public final class BigDecimalParser

private BigDecimalParser() {}

/**
* Internal Jackson method. Please do not use.
*
* @param valueStr
* @return BigDecimal value
* @throws NumberFormatException
*/
public static BigDecimal parse(String valueStr) {
return parse(valueStr.toCharArray());
}

/**
* Internal Jackson method. Please do not use.
*
* @return BigDecimal value
* @throws NumberFormatException
*/
public static BigDecimal parse(final char[] chars, final int off, final int len) {
try {
if (len < 500) {
Expand Down Expand Up @@ -58,6 +79,13 @@ public static BigDecimal parse(final char[] chars, final int off, final int len)
}
}

/**
* Internal Jackson method. Please do not use.
*
* @param chars
* @return BigDecimal value
* @throws NumberFormatException
*/
public static BigDecimal parse(char[] chars) {
return parse(chars, 0, chars.length);
}
Expand Down

0 comments on commit 9e308ea

Please sign in to comment.