Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update javadoc to highlight that this class is for internal jackson use #1156

Merged
merged 2 commits into from Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 30 additions & 2 deletions src/main/java/com/fasterxml/jackson/core/io/BigDecimalParser.java
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