This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git
The following commit(s) were added to refs/heads/master by this push:
new 8f6d35c6 Javadoc
8f6d35c6 is described below
commit 8f6d35c63f74df8923f194753810af02cb1629d9
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 13 13:32:45 2026 +0000
Javadoc
---
.../routines/AbstractNumberValidator.java | 97 ++++++++++------------
1 file changed, 42 insertions(+), 55 deletions(-)
diff --git
a/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
b/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
index 0af0c5dc..5c32ce70 100644
---
a/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
+++
b/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
@@ -36,13 +36,19 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
private static final long serialVersionUID = -3088817875906765463L;
- /** Standard {@code NumberFormat} type */
+ /**
+ * Standard {@code NumberFormat} type.
+ */
public static final int STANDARD_FORMAT = 0;
- /** Currency {@code NumberFormat} type */
+ /**
+ * Currency {@code NumberFormat} type.
+ */
public static final int CURRENCY_FORMAT = 1;
- /** Percent {@code NumberFormat} type */
+ /**
+ * Percent {@code NumberFormat} type.
+ */
public static final int PERCENT_FORMAT = 2;
/**
@@ -56,15 +62,11 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
private final int formatType;
/**
- * Constructs an instance with specified <em>strict</em>
- * and <em>decimal</em> parameters.
+ * Constructs an instance with specified <em>strict</em> and
<em>decimal</em> parameters.
*
- * @param strict {@code true} if strict
- * {@code Format} parsing should be used.
- * @param formatType The {@code NumberFormat} type to
- * create for validation, default is STANDARD_FORMAT.
- * @param allowFractions {@code true} if fractions are
- * allowed or {@code false} if integers only.
+ * @param strict {@code true} if strict {@code Format} parsing
should be used.
+ * @param formatType The {@code NumberFormat} type to create for
validation, default is STANDARD_FORMAT.
+ * @param allowFractions {@code true} if fractions are allowed or {@code
false} if integers only.
*/
public AbstractNumberValidator(final boolean strict, final int formatType,
final boolean allowFractions) {
super(strict);
@@ -75,8 +77,7 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
/**
* Returns the <em>multiplier</em> of the {@code NumberFormat}.
*
- * @param format The {@code NumberFormat} to determine the
- * multiplier of.
+ * @param format The {@code NumberFormat} to determine the multiplier of.
* @return The multiplying factor for the format.
*/
protected int determineScale(final NumberFormat format) {
@@ -108,8 +109,7 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
/**
* Returns a {@code NumberFormat} for the specified Locale.
*
- * @param locale The locale a {@code NumberFormat} is required for,
- * system default if null.
+ * @param locale The locale a {@code NumberFormat} is required for, system
default if null.
* @return The {@code NumberFormat} to created.
*/
protected Format getFormat(final Locale locale) {
@@ -144,12 +144,10 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
}
/**
- * Returns a {@code NumberFormat} for the specified <em>pattern</em>
- * and/or {@link Locale}.
+ * Gets a {@code NumberFormat} for the specified <em>pattern</em> and/or
{@link Locale}.
*
- * @param pattern The pattern used to validate the value against or
- * {@code null} to use the default for the {@link Locale}.
- * @param locale The locale to use for the currency format, system default
if null.
+ * @param pattern The pattern used to validate the value against or {@code
null} to use the default for the {@link Locale}.
+ * @param locale The locale to use for the currency format, system
default if null.
* @return The {@code NumberFormat} to created.
*/
@Override
@@ -169,8 +167,7 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
}
/**
- * Indicates the type of {@code NumberFormat} created
- * by this validator instance.
+ * Gets the type of {@code NumberFormat} created by this validator
instance.
*
* @return the format type created.
*/
@@ -179,36 +176,32 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
}
/**
- * Indicates whether the number being validated is
- * a decimal or integer.
+ * Tests whether the number being validated is a decimal or integer.
*
- * @return {@code true} if decimals are allowed
- * or {@code false} if the number is an integer.
+ * @return {@code true} if decimals are allowed or {@code false} if the
number is an integer.
*/
public boolean isAllowFractions() {
return allowFractions;
}
/**
- * Check if the value is within a specified range.
+ * Tests if the value is within a specified range.
*
* @param value The value validation is being performed on.
- * @param min The minimum value of the range.
- * @param max The maximum value of the range.
- * @return {@code true} if the value is within the
- * specified range.
+ * @param min The minimum value of the range.
+ * @param max The maximum value of the range.
+ * @return {@code true} if the value is within the specified range.
*/
public boolean isInRange(final Number value, final Number min, final
Number max) {
return minValue(value, min) && maxValue(value, max);
}
/**
- * Validate using the specified {@link Locale}.
+ * Tests validity using the specified {@link Locale}.
*
- * @param value The value validation is being performed on.
- * @param pattern The pattern used to validate the value against, or the
- * default for the {@link Locale} if {@code null}.
- * @param locale The locale to use for the date format, system default if
null.
+ * @param value The value validation is being performed on.
+ * @param pattern The pattern used to validate the value against, or the
default for the {@link Locale} if {@code null}.
+ * @param locale The locale to use for the date format, system default if
null.
* @return {@code true} if the value is valid.
*/
@Override
@@ -217,12 +210,11 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
}
/**
- * Check if the value is less than or equal to a maximum.
+ * Tests if the value is less than or equal to a maximum.
*
* @param value The value validation is being performed on.
- * @param max The maximum value.
- * @return {@code true} if the value is less than
- * or equal to the maximum.
+ * @param max The maximum value.
+ * @return {@code true} if the value is less than or equal to the maximum.
*/
public boolean maxValue(final Number value, final Number max) {
if (isAllowFractions()) {
@@ -232,12 +224,11 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
}
/**
- * Check if the value is greater than or equal to a minimum.
+ * Tests if the value is greater than or equal to a minimum.
*
* @param value The value validation is being performed on.
- * @param min The minimum value.
- * @return {@code true} if the value is greater than
- * or equal to the minimum.
+ * @param min The minimum value.
+ * @return {@code true} if the value is greater than or equal to the
minimum.
*/
public boolean minValue(final Number value, final Number min) {
if (isAllowFractions()) {
@@ -247,12 +238,11 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
}
/**
- * Parse the value using the specified pattern.
+ * Parses the value using the specified pattern.
*
- * @param value The value validation is being performed on.
- * @param pattern The pattern used to validate the value against, or the
- * default for the {@link Locale} if {@code null}.
- * @param locale The locale to use for the date format, system default if
null.
+ * @param value The value validation is being performed on.
+ * @param pattern The pattern used to validate the value against, or the
default for the {@link Locale} if {@code null}.
+ * @param locale The locale to use for the date format, system default if
null.
* @return The parsed value if valid or {@code null} if invalid.
*/
protected Object parse(String value, final String pattern, final Locale
locale) {
@@ -262,17 +252,14 @@ public abstract class AbstractNumberValidator extends
AbstractFormatValidator {
return null;
}
return parse(value, getFormat(pattern, locale));
-
}
/**
- * Process the parsed value, performing any further validation
- * and type conversion required.
+ * Processes the parsed value, performing any further validation and type
conversion required.
*
- * @param value The parsed object created.
+ * @param value The parsed object created.
* @param formatter The Format used to parse the value with.
- * @return The parsed value converted to the appropriate type
- * if valid or {@code null} if invalid.
+ * @return The parsed value converted to the appropriate type if valid or
{@code null} if invalid.
*/
@Override
protected abstract Object processParsedValue(Object value, Format
formatter);