You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/01/05 18:45:52 UTC
svn commit: r1227719 [2/3] - in
/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator:
./ routines/ routines/checkdigit/ util/
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CurrencyValidator.java Thu Jan 5 17:45:51 2012
@@ -21,29 +21,31 @@ import java.text.Format;
/**
* <p><b>Currency Validation</b> and Conversion routines (<code>java.math.BigDecimal</code>).</p>
- *
+ *
* <p>This is one implementation of a currency validator that has the following features:</p>
* <ul>
* <li>It is <i>lenient</i> about the the presence of the <i>currency symbol</i></li>
* <li>It converts the currency to a <code>java.math.BigDecimal</code></li>
* </ul>
- *
+ *
* <p>However any of the <i>number</i> validators can be used for <i>currency</i> validation.
* For example, if you wanted a <i>currency</i> validator that converts to a
* <code>java.lang.Integer</code> then you can simply instantiate an
* <code>IntegerValidator</code> with the appropriate <i>format type</i>:</p>
- *
+ *
* <p><code>... = new IntegerValidator(false, IntegerValidator.CURRENCY_FORMAT);</code></p>
*
* <p>Pick the appropriate validator, depending on the type (e.g Float, Double, Integer, Long etc)
* you want the currency converted to. One thing to note - only the CurrencyValidator
* implements <i>lenient</i> behaviour regarding the currency symbol.</p>
- *
+ *
* @version $Revision$ $Date$
* @since Validator 1.3.0
*/
public class CurrencyValidator extends BigDecimalValidator {
+ private static final long serialVersionUID = -4201640771171486514L;
+
private static final CurrencyValidator VALIDATOR = new CurrencyValidator();
/** DecimalFormat's currency symbol */
@@ -66,8 +68,8 @@ public class CurrencyValidator extends B
/**
* Construct an instance with the specified strict setting.
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param allowFractions <code>true</code> if fractions are
* allowed or <code>false</code> if integers only.
@@ -78,13 +80,13 @@ public class CurrencyValidator extends B
/**
* <p>Parse the value with the specified <code>Format</code>.</p>
- *
+ *
* <p>This implementation is lenient whether the currency symbol
* is present or not. The default <code>NumberFormat</code>
* behaviour is for the parsing to "fail" if the currency
* symbol is missing. This method re-parses with a format
* without the currency symbol if it fails initially.</p>
- *
+ *
* @param value The value to be parsed.
* @param formatter The Format to parse the value with.
* @return The parsed value if valid or <code>null</code> if invalid.
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DateValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DateValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DateValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DateValidator.java Thu Jan 5 17:45:51 2012
@@ -27,7 +27,7 @@ import java.util.TimeZone;
* <p><b>Date Validation</b> and Conversion routines (<code>java.util.Date</code>).</p>
*
* <p>This validator provides a number of methods for validating/converting
- * a <code>String</code> date value to a <code>java.util.Date</code> using
+ * a <code>String</code> date value to a <code>java.util.Date</code> using
* <code>java.text.DateFormat</code> to parse either:</p>
* <ul>
* <li>using the default format for the default <code>Locale</code></li>
@@ -35,27 +35,27 @@ import java.util.TimeZone;
* <li>using the default format for a specified <code>Locale</code></li>
* <li>using a specified pattern with a specified <code>Locale</code></li>
* </ul>
- *
- * <p>For each of the above mechanisms, conversion method (i.e the
+ *
+ * <p>For each of the above mechanisms, conversion method (i.e the
* <code>validate</code> methods) implementations are provided which
- * either use the default <code>TimeZone</code> or allow the
+ * either use the default <code>TimeZone</code> or allow the
* <code>TimeZone</code> to be specified.</p>
- *
+ *
* <p>Use one of the <code>isValid()</code> methods to just validate or
* one of the <code>validate()</code> methods to validate and receive a
* <i>converted</i> <code>Date</code> value.</p>
- *
+ *
* <p>Implementations of the <code>validate()</code> method are provided
* to create <code>Date</code> objects for different <i>time zones</i>
* if the system default is not appropriate.</p>
- *
+ *
* <p>Once a value has been sucessfully converted the following
* methods can be used to perform various date comparison checks:</p>
* <ul>
* <li><code>compareDates()</code> compares the day, month and
* year of two dates, returing 0, -1 or +1 indicating
* whether the first date is equal, before or after the second.</li>
- * <li><code>compareWeeks()</code> compares the week and
+ * <li><code>compareWeeks()</code> compares the week and
* year of two dates, returing 0, -1 or +1 indicating
* whether the first week is equal, before or after the second.</li>
* <li><code>compareMonths()</code> compares the month and
@@ -64,26 +64,28 @@ import java.util.TimeZone;
* <li><code>compareQuarters()</code> compares the quarter and
* year of two dates, returing 0, -1 or +1 indicating
* whether the first quarter is equal, before or after the second.</li>
- * <li><code>compareYears()</code> compares the
+ * <li><code>compareYears()</code> compares the
* year of two dates, returing 0, -1 or +1 indicating
* whether the first year is equal, before or after the second.</li>
* </ul>
- *
- * <p>So that the same mechanism used for parsing an <i>input</i> value
+ *
+ * <p>So that the same mechanism used for parsing an <i>input</i> value
* for validation can be used to format <i>output</i>, corresponding
- * <code>format()</code> methods are also provided. That is you can
+ * <code>format()</code> methods are also provided. That is you can
* format either:</p>
* <ul>
* <li>using a specified pattern</li>
* <li>using the format for a specified <code>Locale</code></li>
* <li>using the format for the <i>default</i> <code>Locale</code></li>
* </ul>
- *
+ *
* @version $Revision$ $Date$
* @since Validator 1.3.0
*/
public class DateValidator extends AbstractCalendarValidator {
+ private static final long serialVersionUID = -3966328400469953190L;
+
private static final DateValidator VALIDATOR = new DateValidator();
/**
@@ -105,8 +107,8 @@ public class DateValidator extends Abstr
/**
* Construct an instance with the specified <i>strict</i>
* and <i>date style</i> parameters.
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param dateStyle the date style to use for Locale validation.
*/
@@ -116,7 +118,7 @@ public class DateValidator extends Abstr
/**
* <p>Validate/convert a <code>Date</code> using the default
- * <code>Locale</code> and <code>TimeZone</code>.
+ * <code>Locale</code> and <code>TimeZone</code>.
*
* @param value The value validation is being performed on.
* @return The parsed <code>Date</code> if valid or <code>null</code>
@@ -221,7 +223,7 @@ public class DateValidator extends Abstr
/**
* <p>Compare Dates (day, month and year - not time).</p>
- *
+ *
* @param value The <code>Calendar</code> value to check.
* @param compare The <code>Calendar</code> to compare the value to.
* @param timeZone The Time Zone used to compare the dates, system default if null.
@@ -237,7 +239,7 @@ public class DateValidator extends Abstr
/**
* <p>Compare Weeks (week and year).</p>
- *
+ *
* @param value The <code>Date</code> value to check.
* @param compare The <code>Date</code> to compare the value to.
* @param timeZone The Time Zone used to compare the dates, system default if null.
@@ -253,7 +255,7 @@ public class DateValidator extends Abstr
/**
* <p>Compare Months (month and year).</p>
- *
+ *
* @param value The <code>Date</code> value to check.
* @param compare The <code>Date</code> to compare the value to.
* @param timeZone The Time Zone used to compare the dates, system default if null.
@@ -269,7 +271,7 @@ public class DateValidator extends Abstr
/**
* <p>Compare Quarters (quarter and year).</p>
- *
+ *
* @param value The <code>Date</code> value to check.
* @param compare The <code>Date</code> to compare the value to.
* @param timeZone The Time Zone used to compare the dates, system default if null.
@@ -283,7 +285,7 @@ public class DateValidator extends Abstr
/**
* <p>Compare Quarters (quarter and year).</p>
- *
+ *
* @param value The <code>Date</code> value to check.
* @param compare The <code>Date</code> to compare the value to.
* @param timeZone The Time Zone used to compare the dates, system default if null.
@@ -300,7 +302,7 @@ public class DateValidator extends Abstr
/**
* <p>Compare Years.</p>
- *
+ *
* @param value The <code>Date</code> value to check.
* @param compare The <code>Date</code> to compare the value to.
* @param timeZone The Time Zone used to compare the dates, system default if null.
@@ -316,7 +318,7 @@ public class DateValidator extends Abstr
/**
* <p>Returns the parsed <code>Date</code> unchanged.</p>
- *
+ *
* @param value The parsed <code>Date</code> object created.
* @param formatter The Format used to parse the value with.
* @return The parsed value converted to a <code>Calendar</code>.
@@ -327,7 +329,7 @@ public class DateValidator extends Abstr
/**
* <p>Convert a <code>Date</code> to a <code>Calendar</code>.</p>
- *
+ *
* @param value The date value to be converted.
* @return The converted <code>Calendar</code>.
*/
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DomainValidator.java Thu Jan 5 17:45:51 2012
@@ -62,6 +62,8 @@ import java.util.List;
*/
public class DomainValidator implements Serializable {
+ private static final long serialVersionUID = -4407125112880174009L;
+
// Regular expression strings for hostnames (derived from RFC2396 and RFC 1123)
private static final String DOMAIN_LABEL_REGEX = "\\p{Alnum}(?>[\\p{Alnum}-]*\\p{Alnum})*";
private static final String TOP_LABEL_REGEX = "\\p{Alpha}{2,}";
@@ -69,13 +71,13 @@ public class DomainValidator implements
"^(?:" + DOMAIN_LABEL_REGEX + "\\.)+" + "(" + TOP_LABEL_REGEX + ")$";
private final boolean allowLocal;
-
+
/**
* Singleton instance of this validator, which
* doesn't consider local addresses as valid.
*/
private static final DomainValidator DOMAIN_VALIDATOR = new DomainValidator(false);
-
+
/**
* Singleton instance of this validator, which does
* consider local addresses valid.
@@ -101,7 +103,7 @@ public class DomainValidator implements
public static DomainValidator getInstance() {
return DOMAIN_VALIDATOR;
}
-
+
/**
* Returns the singleton instance of this validator,
* with local validation as required.
@@ -249,7 +251,7 @@ public class DomainValidator implements
"ai", // Anguilla
"al", // Albania
"am", // Armenia
- "an", // Netherlands Antilles
+ "an", // Netherlands Antilles
"ao", // Angola
"aq", // Antarctica
"ar", // Argentina
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/DoubleValidator.java Thu Jan 5 17:45:51 2012
@@ -32,11 +32,11 @@ import java.util.Locale;
* <li>using the default format for a specified <code>Locale</code></li>
* <li>using a specified pattern with a specified <code>Locale</code></li>
* </ul>
- *
+ *
* <p>Use one of the <code>isValid()</code> methods to just validate or
* one of the <code>validate()</code> methods to validate and receive a
* <i>converted</i> <code>Double</code> value.</p>
- *
+ *
* <p>Once a value has been sucessfully converted the following
* methods can be used to perform minimum, maximum and range checks:</p>
* <ul>
@@ -47,10 +47,10 @@ import java.util.Locale;
* <li><code>isInRange()</code> checks whether the value is within
* a specified range of values.</li>
* </ul>
- *
- * <p>So that the same mechanism used for parsing an <i>input</i> value
+ *
+ * <p>So that the same mechanism used for parsing an <i>input</i> value
* for validation can be used to format <i>output</i>, corresponding
- * <code>format()</code> methods are also provided. That is you can
+ * <code>format()</code> methods are also provided. That is you can
* format either:</p>
* <ul>
* <li>using the default format for the default <code>Locale</code></li>
@@ -64,6 +64,8 @@ import java.util.Locale;
*/
public class DoubleValidator extends AbstractNumberValidator {
+ private static final long serialVersionUID = 5867946581318211330L;
+
private static final DoubleValidator VALIDATOR = new DoubleValidator();
/**
@@ -84,7 +86,7 @@ public class DoubleValidator extends Abs
/**
* <p>Construct an instance with the specified strict setting
* and format type.</p>
- *
+ *
* <p>The <code>formatType</code> specified what type of
* <code>NumberFormat</code> is created - valid types
* are:</p>
@@ -96,8 +98,8 @@ public class DoubleValidator extends Abs
* <li>AbstractNumberValidator.PERCENT_FORMAT -to create
* <i>percent</i> number formats (the default).</li>
* </ul>
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param formatType The <code>NumberFormat</code> type to
* create for validation, default is STANDARD_FORMAT.
@@ -108,7 +110,7 @@ public class DoubleValidator extends Abs
/**
* <p>Validate/convert a <code>Double</code> using the default
- * <code>Locale</code>.
+ * <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @return The parsed <code>Double</code> if valid or <code>null</code>
@@ -120,7 +122,7 @@ public class DoubleValidator extends Abs
/**
* <p>Validate/convert a <code>Double</code> using the
- * specified <i>pattern</i>.
+ * specified <i>pattern</i>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
@@ -132,7 +134,7 @@ public class DoubleValidator extends Abs
/**
* <p>Validate/convert a <code>Double</code> using the
- * specified <code>Locale</code>.
+ * specified <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param locale The locale to use for the number format, system default if null.
@@ -144,7 +146,7 @@ public class DoubleValidator extends Abs
/**
* <p>Validate/convert a <code>Double</code> using the
- * specified pattern and/ or <code>Locale</code>.
+ * specified pattern and/ or <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against, or the
@@ -158,7 +160,7 @@ public class DoubleValidator extends Abs
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -171,7 +173,7 @@ public class DoubleValidator extends Abs
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -184,7 +186,7 @@ public class DoubleValidator extends Abs
/**
* Check 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</code> if the value is greater than
@@ -196,7 +198,7 @@ public class DoubleValidator extends Abs
/**
* Check 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</code> if the value is greater than
@@ -208,7 +210,7 @@ public class DoubleValidator extends Abs
/**
* Check 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</code> if the value is less than
@@ -220,7 +222,7 @@ public class DoubleValidator extends Abs
/**
* Check 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</code> if the value is less than
@@ -232,10 +234,10 @@ public class DoubleValidator extends Abs
/**
* Convert the parsed value to a <code>Double</code>.
- *
+ *
* @param value The parsed <code>Number</code> object created.
* @param formatter The Format used to parse the value with.
- * @return The validated/converted <code>Double</code> value if valid
+ * @return The validated/converted <code>Double</code> value if valid
* or <code>null</code> if invalid.
*/
protected Object processParsedValue(Object value, Format formatter) {
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/EmailValidator.java Thu Jan 5 17:45:51 2012
@@ -40,6 +40,8 @@ import java.util.regex.Pattern;
*/
public class EmailValidator implements Serializable {
+ private static final long serialVersionUID = 1705927040799295880L;
+
private static final String SPECIAL_CHARS = "\\p{Cntrl}\\(\\)<>@,;:'\\\\\\\"\\.\\[\\]";
private static final String VALID_CHARS = "[^\\s" + SPECIAL_CHARS + "]";
private static final String QUOTED_USER = "(\"[^\"]*\")";
@@ -56,13 +58,13 @@ public class EmailValidator implements S
private static final Pattern USER_PATTERN = Pattern.compile(USER_REGEX);
private final boolean allowLocal;
-
+
/**
* Singleton instance of this class, which
* doesn't consider local addresses as valid.
*/
private static final EmailValidator EMAIL_VALIDATOR = new EmailValidator(false);
-
+
/**
* Singleton instance of this class, which does
* consider local addresses valid.
@@ -81,7 +83,7 @@ public class EmailValidator implements S
/**
* Returns the Singleton instance of this validator,
* with local validation as required.
- *
+ *
* @param allowLocal Should local addresses be considered valid?
* @return singleton instance of this validator
*/
@@ -92,9 +94,9 @@ public class EmailValidator implements S
return EMAIL_VALIDATOR;
}
- /**
+ /**
* Protected constructor for subclasses to use.
- *
+ *
* @param allowLocal Should local addresses be considered valid?
*/
protected EmailValidator(boolean allowLocal) {
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/FloatValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/FloatValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/FloatValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/FloatValidator.java Thu Jan 5 17:45:51 2012
@@ -32,11 +32,11 @@ import java.util.Locale;
* <li>using the default format for a specified <code>Locale</code></li>
* <li>using a specified pattern with a specified <code>Locale</code></li>
* </ul>
- *
+ *
* <p>Use one of the <code>isValid()</code> methods to just validate or
* one of the <code>validate()</code> methods to validate and receive a
* <i>converted</i> <code>Float</code> value.</p>
- *
+ *
* <p>Once a value has been sucessfully converted the following
* methods can be used to perform minimum, maximum and range checks:</p>
* <ul>
@@ -47,10 +47,10 @@ import java.util.Locale;
* <li><code>isInRange()</code> checks whether the value is within
* a specified range of values.</li>
* </ul>
- *
- * <p>So that the same mechanism used for parsing an <i>input</i> value
+ *
+ * <p>So that the same mechanism used for parsing an <i>input</i> value
* for validation can be used to format <i>output</i>, corresponding
- * <code>format()</code> methods are also provided. That is you can
+ * <code>format()</code> methods are also provided. That is you can
* format either:</p>
* <ul>
* <li>using the default format for the default <code>Locale</code></li>
@@ -64,6 +64,8 @@ import java.util.Locale;
*/
public class FloatValidator extends AbstractNumberValidator {
+ private static final long serialVersionUID = -4513245432806414267L;
+
private static final FloatValidator VALIDATOR = new FloatValidator();
/**
@@ -84,7 +86,7 @@ public class FloatValidator extends Abst
/**
* <p>Construct an instance with the specified strict setting
* and format type.</p>
- *
+ *
* <p>The <code>formatType</code> specified what type of
* <code>NumberFormat</code> is created - valid types
* are:</p>
@@ -96,8 +98,8 @@ public class FloatValidator extends Abst
* <li>AbstractNumberValidator.PERCENT_FORMAT -to create
* <i>percent</i> number formats (the default).</li>
* </ul>
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param formatType The <code>NumberFormat</code> type to
* create for validation, default is STANDARD_FORMAT.
@@ -108,7 +110,7 @@ public class FloatValidator extends Abst
/**
* <p>Validate/convert a <code>Float</code> using the default
- * <code>Locale</code>.
+ * <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @return The parsed <code>Float</code> if valid or <code>null</code>
@@ -120,7 +122,7 @@ public class FloatValidator extends Abst
/**
* <p>Validate/convert a <code>Float</code> using the
- * specified <i>pattern</i>.
+ * specified <i>pattern</i>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
@@ -132,7 +134,7 @@ public class FloatValidator extends Abst
/**
* <p>Validate/convert a <code>Float</code> using the
- * specified <code>Locale</code>.
+ * specified <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param locale The locale to use for the number format, system default if null.
@@ -144,7 +146,7 @@ public class FloatValidator extends Abst
/**
* <p>Validate/convert a <code>Float</code> using the
- * specified pattern and/ or <code>Locale</code>.
+ * specified pattern and/ or <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against, or the
@@ -158,7 +160,7 @@ public class FloatValidator extends Abst
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -171,7 +173,7 @@ public class FloatValidator extends Abst
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -184,7 +186,7 @@ public class FloatValidator extends Abst
/**
* Check 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</code> if the value is greater than
@@ -196,7 +198,7 @@ public class FloatValidator extends Abst
/**
* Check 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</code> if the value is greater than
@@ -208,7 +210,7 @@ public class FloatValidator extends Abst
/**
* Check 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</code> if the value is less than
@@ -220,7 +222,7 @@ public class FloatValidator extends Abst
/**
* Check 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</code> if the value is less than
@@ -233,10 +235,10 @@ public class FloatValidator extends Abst
/**
* <p>Perform further validation and convert the <code>Number</code> to
* a <code>Float</code>.</p>
- *
+ *
* @param value The parsed <code>Number</code> object created.
* @param formatter The Format used to parse the value with.
- * @return The parsed <code>Number</code> converted to a
+ * @return The parsed <code>Number</code> converted to a
* <code>Float</code> if valid or <code>null</code> if invalid.
*/
protected Object processParsedValue(Object value, Format formatter) {
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ISBNValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ISBNValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ISBNValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ISBNValidator.java Thu Jan 5 17:45:51 2012
@@ -24,7 +24,7 @@ import org.apache.commons.validator.rout
/**
* <b>ISBN-10</b> and <b>ISBN-13</b> Code Validation.
* <p>
- * This validator validates the code is either a valid ISBN-10
+ * This validator validates the code is either a valid ISBN-10
* (using a {@link CodeValidator} with the {@link ISBN10CheckDigit})
* or a valid ISBN-13 code (using a {@link CodeValidator} with the
* the {@link EAN13CheckDigit} routine).
@@ -43,18 +43,20 @@ import org.apache.commons.validator.rout
* <ul>
* <li><a href="http://en.wikipedia.org/wiki/ISBN">Wikipedia - International
* Standard Book Number (ISBN)</a>.</li>
- * <li>EAN - see
- * <a href="http://en.wikipedia.org/wiki/European_Article_Number">Wikipedia -
+ * <li>EAN - see
+ * <a href="http://en.wikipedia.org/wiki/European_Article_Number">Wikipedia -
* European Article Number</a>.</li>
* <li><a href="http://www.isbn.org/standards/home/isbn/transition.asp">ISBN-13
* Transition details</a>.</li>
* </ul>
- *
+ *
* @version $Revision$ $Date$
* @since Validator 1.4
*/
public class ISBNValidator implements Serializable {
+ private static final long serialVersionUID = 4319515687976420405L;
+
private static final String SEP = "(?:\\-|\\s)";
private static final String GROUP = "(\\d{1,5})";
private static final String PUBLISHER = "(\\d{1,7})";
@@ -65,15 +67,15 @@ public class ISBNValidator implements Se
* or spaces. The first group is 1-5 characters, second 1-7, third 1-6,
* and fourth is 1 digit or an X.
*/
- static final String ISBN10_REGEX =
+ static final String ISBN10_REGEX =
"^(?:(\\d{9}[0-9X])|(?:" + GROUP + SEP + PUBLISHER + SEP + TITLE + SEP + "([0-9X])))$";
/**
* ISBN-13 consists of 5 groups of numbers separated by either dashes (-)
- * or spaces. The first group is 978 or 979, the second group is
+ * or spaces. The first group is 978 or 979, the second group is
* 1-5 characters, third 1-7, fourth 1-6, and fifth is 1 digit.
*/
- static final String ISBN13_REGEX =
+ static final String ISBN13_REGEX =
"^(978|979)(?:(\\d{10})|(?:" + SEP + GROUP + SEP + PUBLISHER + SEP + TITLE + SEP + "([0-9])))$";
/** ISBN Code Validator (which converts ISBN-10 codes to ISBN-13 */
@@ -100,7 +102,7 @@ public class ISBNValidator implements Se
public static ISBNValidator getInstance() {
return ISBN_VALIDATOR;
}
-
+
/**
* Return a singleton instance of the ISBN validator specifying
* whether ISBN-10 codes should be converted to ISBN-13.
@@ -138,7 +140,7 @@ public class ISBNValidator implements Se
* Check the code is either a valid ISBN-10 or ISBN-13 code.
*
* @param code The code to validate.
- * @return <code>true</code> if a valid ISBN-10 or
+ * @return <code>true</code> if a valid ISBN-10 or
* ISBN-13 code, otherwise <code>false</code>.
*/
public boolean isValid(String code) {
@@ -149,7 +151,7 @@ public class ISBNValidator implements Se
* Check the code is a valid ISBN-10 code.
*
* @param code The code to validate.
- * @return <code>true</code> if a valid ISBN-10
+ * @return <code>true</code> if a valid ISBN-10
* code, otherwise <code>false</code>.
*/
public boolean isValidISBN10(String code) {
@@ -160,7 +162,7 @@ public class ISBNValidator implements Se
* Check the code is a valid ISBN-13 code.
*
* @param code The code to validate.
- * @return <code>true</code> if a valid ISBN-13
+ * @return <code>true</code> if a valid ISBN-13
* code, otherwise <code>false</code>.
*/
public boolean isValidISBN13(String code) {
@@ -173,7 +175,7 @@ public class ISBNValidator implements Se
* If valid, this method returns the ISBN code with
* formatting characters removed (i.e. space or hyphen).
* <p>
- * Converts an ISBN-10 codes to ISBN-13 if
+ * Converts an ISBN-10 codes to ISBN-13 if
* <code>convertToISBN13</code> is <code>true</code>.
*
* @param code The code to validate.
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java Thu Jan 5 17:45:51 2012
@@ -33,6 +33,8 @@ import java.io.Serializable;
*/
public class InetAddressValidator implements Serializable {
+ private static final long serialVersionUID = -919201640201914789L;
+
private static final String IPV4_REGEX =
"^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$";
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/IntegerValidator.java Thu Jan 5 17:45:51 2012
@@ -32,11 +32,11 @@ import java.util.Locale;
* <li>using the default format for a specified <code>Locale</code></li>
* <li>using a specified pattern with a specified <code>Locale</code></li>
* </ul>
- *
+ *
* <p>Use one of the <code>isValid()</code> methods to just validate or
* one of the <code>validate()</code> methods to validate and receive a
* <i>converted</i> <code>Integer</code> value.</p>
- *
+ *
* <p>Once a value has been sucessfully converted the following
* methods can be used to perform minimum, maximum and range checks:</p>
* <ul>
@@ -47,10 +47,10 @@ import java.util.Locale;
* <li><code>isInRange()</code> checks whether the value is within
* a specified range of values.</li>
* </ul>
- *
- * <p>So that the same mechanism used for parsing an <i>input</i> value
+ *
+ * <p>So that the same mechanism used for parsing an <i>input</i> value
* for validation can be used to format <i>output</i>, corresponding
- * <code>format()</code> methods are also provided. That is you can
+ * <code>format()</code> methods are also provided. That is you can
* format either:</p>
* <ul>
* <li>using the default format for the default <code>Locale</code></li>
@@ -64,6 +64,8 @@ import java.util.Locale;
*/
public class IntegerValidator extends AbstractNumberValidator {
+ private static final long serialVersionUID = 422081746310306596L;
+
private static final IntegerValidator VALIDATOR = new IntegerValidator();
/**
@@ -84,7 +86,7 @@ public class IntegerValidator extends Ab
/**
* <p>Construct an instance with the specified strict setting
* and format type.</p>
- *
+ *
* <p>The <code>formatType</code> specified what type of
* <code>NumberFormat</code> is created - valid types
* are:</p>
@@ -96,8 +98,8 @@ public class IntegerValidator extends Ab
* <li>AbstractNumberValidator.PERCENT_FORMAT -to create
* <i>percent</i> number formats (the default).</li>
* </ul>
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param formatType The <code>NumberFormat</code> type to
* create for validation, default is STANDARD_FORMAT.
@@ -108,7 +110,7 @@ public class IntegerValidator extends Ab
/**
* <p>Validate/convert an <code>Integer</code> using the default
- * <code>Locale</code>.
+ * <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @return The parsed <code>Integer</code> if valid or <code>null</code>
@@ -120,7 +122,7 @@ public class IntegerValidator extends Ab
/**
* <p>Validate/convert an <code>Integer</code> using the
- * specified <i>pattern</i>.
+ * specified <i>pattern</i>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
@@ -132,7 +134,7 @@ public class IntegerValidator extends Ab
/**
* <p>Validate/convert an <code>Integer</code> using the
- * specified <code>Locale</code>.
+ * specified <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param locale The locale to use for the number format, system default if null.
@@ -144,7 +146,7 @@ public class IntegerValidator extends Ab
/**
* <p>Validate/convert a <code>Integer</code> using the
- * specified pattern and/ or <code>Locale</code>.
+ * specified pattern and/ or <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against, or the
@@ -158,7 +160,7 @@ public class IntegerValidator extends Ab
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -171,7 +173,7 @@ public class IntegerValidator extends Ab
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -184,7 +186,7 @@ public class IntegerValidator extends Ab
/**
* Check 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</code> if the value is greater than
@@ -196,7 +198,7 @@ public class IntegerValidator extends Ab
/**
* Check 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</code> if the value is greater than
@@ -208,7 +210,7 @@ public class IntegerValidator extends Ab
/**
* Check 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</code> if the value is less than
@@ -220,7 +222,7 @@ public class IntegerValidator extends Ab
/**
* Check 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</code> if the value is less than
@@ -233,17 +235,17 @@ public class IntegerValidator extends Ab
/**
* <p>Perform further validation and convert the <code>Number</code> to
* an <code>Integer</code>.</p>
- *
+ *
* @param value The parsed <code>Number</code> object created.
* @param formatter The Format used to parse the value with.
- * @return The parsed <code>Number</code> converted to an
+ * @return The parsed <code>Number</code> converted to an
* <code>Integer</code> if valid or <code>null</code> if invalid.
*/
protected Object processParsedValue(Object value, Format formatter) {
long longValue = ((Number)value).longValue();
- if (longValue < Integer.MIN_VALUE ||
+ if (longValue < Integer.MIN_VALUE ||
longValue > Integer.MAX_VALUE) {
return null;
} else {
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/LongValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/LongValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/LongValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/LongValidator.java Thu Jan 5 17:45:51 2012
@@ -32,11 +32,11 @@ import java.util.Locale;
* <li>using the default format for a specified <code>Locale</code></li>
* <li>using a specified pattern with a specified <code>Locale</code></li>
* </ul>
- *
+ *
* <p>Use one of the <code>isValid()</code> methods to just validate or
* one of the <code>validate()</code> methods to validate and receive a
* <i>converted</i> <code>Long</code> value.</p>
- *
+ *
* <p>Once a value has been sucessfully converted the following
* methods can be used to perform minimum, maximum and range checks:</p>
* <ul>
@@ -47,10 +47,10 @@ import java.util.Locale;
* <li><code>isInRange()</code> checks whether the value is within
* a specified range of values.</li>
* </ul>
- *
- * <p>So that the same mechanism used for parsing an <i>input</i> value
+ *
+ * <p>So that the same mechanism used for parsing an <i>input</i> value
* for validation can be used to format <i>output</i>, corresponding
- * <code>format()</code> methods are also provided. That is you can
+ * <code>format()</code> methods are also provided. That is you can
* format either:</p>
* <ul>
* <li>using a specified pattern</li>
@@ -63,6 +63,8 @@ import java.util.Locale;
*/
public class LongValidator extends AbstractNumberValidator {
+ private static final long serialVersionUID = -5117231731027866098L;
+
private static final LongValidator VALIDATOR = new LongValidator();
/**
@@ -83,7 +85,7 @@ public class LongValidator extends Abstr
/**
* <p>Construct an instance with the specified strict setting
* and format type.</p>
- *
+ *
* <p>The <code>formatType</code> specified what type of
* <code>NumberFormat</code> is created - valid types
* are:</p>
@@ -95,8 +97,8 @@ public class LongValidator extends Abstr
* <li>AbstractNumberValidator.PERCENT_FORMAT -to create
* <i>percent</i> number formats (the default).</li>
* </ul>
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param formatType The <code>NumberFormat</code> type to
* create for validation, default is STANDARD_FORMAT.
@@ -107,7 +109,7 @@ public class LongValidator extends Abstr
/**
* <p>Validate/convert a <code>Long</code> using the default
- * <code>Locale</code>.
+ * <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @return The parsed <code>Long</code> if valid or <code>null</code>
@@ -119,7 +121,7 @@ public class LongValidator extends Abstr
/**
* <p>Validate/convert a <code>Long</code> using the
- * specified <i>pattern</i>.
+ * specified <i>pattern</i>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
@@ -131,7 +133,7 @@ public class LongValidator extends Abstr
/**
* <p>Validate/convert a <code>Long</code> using the
- * specified <code>Locale</code>.
+ * specified <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param locale The locale to use for the number format, system default if null.
@@ -143,7 +145,7 @@ public class LongValidator extends Abstr
/**
* <p>Validate/convert a <code>Long</code> using the
- * specified pattern and/ or <code>Locale</code>.
+ * specified pattern and/ or <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against, or the
@@ -157,7 +159,7 @@ public class LongValidator extends Abstr
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -170,7 +172,7 @@ public class LongValidator extends Abstr
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -183,7 +185,7 @@ public class LongValidator extends Abstr
/**
* Check 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</code> if the value is greater than
@@ -195,7 +197,7 @@ public class LongValidator extends Abstr
/**
* Check 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</code> if the value is greater than
@@ -207,7 +209,7 @@ public class LongValidator extends Abstr
/**
* Check 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</code> if the value is less than
@@ -219,7 +221,7 @@ public class LongValidator extends Abstr
/**
* Check 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</code> if the value is less than
@@ -231,10 +233,10 @@ public class LongValidator extends Abstr
/**
* Convert the parsed value to a <code>Long</code>.
- *
+ *
* @param value The parsed <code>Number</code> object created.
* @param formatter The Format used to parse the value with.
- * @return The parsed <code>Number</code> converted to a
+ * @return The parsed <code>Number</code> converted to a
* <code>Long</code>.
*/
protected Object processParsedValue(Object value, Format formatter) {
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/PercentValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/PercentValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/PercentValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/PercentValidator.java Thu Jan 5 17:45:51 2012
@@ -22,18 +22,18 @@ import java.math.BigDecimal;
/**
* <p><b>Percentage Validation</b> and Conversion routines (<code>java.math.BigDecimal</code>).</p>
- *
+ *
* <p>This is one implementation of a percent validator that has the following features:</p>
* <ul>
* <li>It is <i>lenient</i> about the the presence of the <i>percent symbol</i></li>
* <li>It converts the percent to a <code>java.math.BigDecimal</code></li>
* </ul>
- *
+ *
* <p>However any of the <i>number</i> validators can be used for <i>percent</i> validation.
* For example, if you wanted a <i>percent</i> validator that converts to a
* <code>java.lang.Float</code> then you can simply instantiate an
* <code>FloatValidator</code> with the appropriate <i>format type</i>:</p>
- *
+ *
* <p><code>... = new FloatValidator(false, FloatValidator.PERCENT_FORMAT);</code></p>
*
* <p>Pick the appropriate validator, depending on the type (i.e Float, Double or BigDecimal)
@@ -47,6 +47,8 @@ import java.math.BigDecimal;
*/
public class PercentValidator extends BigDecimalValidator {
+ private static final long serialVersionUID = -3508241924961535772L;
+
private static final PercentValidator VALIDATOR = new PercentValidator();
/** DecimalFormat's percent (thousand multiplier) symbol */
@@ -71,8 +73,8 @@ public class PercentValidator extends Bi
/**
* Construct an instance with the specified strict setting.
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
*/
public PercentValidator(boolean strict) {
@@ -81,13 +83,13 @@ public class PercentValidator extends Bi
/**
* <p>Parse the value with the specified <code>Format</code>.</p>
- *
+ *
* <p>This implementation is lenient whether the currency symbol
* is present or not. The default <code>NumberFormat</code>
* behaviour is for the parsing to "fail" if the currency
* symbol is missing. This method re-parses with a format
* without the currency symbol if it fails initially.</p>
- *
+ *
* @param value The value to be parsed.
* @param formatter The Format to parse the value with.
* @return The parsed value if valid or <code>null</code> if invalid.
@@ -112,12 +114,12 @@ public class PercentValidator extends Bi
}
decimalFormat.applyPattern(buffer.toString());
parsedValue = (BigDecimal)super.parse(value, decimalFormat);
-
+
// If parsed OK, divide by 100 to get percent
if (parsedValue != null) {
parsedValue = parsedValue.multiply(POINT_ZERO_ONE);
}
-
+
}
return parsedValue;
}
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/RegexValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/RegexValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/RegexValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/RegexValidator.java Thu Jan 5 17:45:51 2012
@@ -23,7 +23,7 @@ import java.util.regex.Matcher;
/**
* <b>Regular Expression</b> validation (using JDK 1.4+ regex support).
* <p>
- * Construct the validator either for a single regular expression or a set (array) of
+ * Construct the validator either for a single regular expression or a set (array) of
* regular expressions. By default validation is <i>case sensitive</i> but constructors
* are provided to allow <i>case in-sensitive</i> validation. For example to create
* a validator which does <i>case in-sensitive</i> validation for a set of regular
@@ -56,6 +56,8 @@ import java.util.regex.Matcher;
*/
public class RegexValidator implements Serializable {
+ private static final long serialVersionUID = -8832409930574867162L;
+
private final Pattern[] patterns;
/**
@@ -120,7 +122,7 @@ public class RegexValidator implements S
* Validate a value against the set of regular expressions.
*
* @param value The value to validate.
- * @return <code>true</code> if the value is valid
+ * @return <code>true</code> if the value is valid
* otherwise <code>false</code>.
*/
public boolean isValid(String value) {
@@ -141,7 +143,7 @@ public class RegexValidator implements S
*
* @param value The value to validate.
* @return String array of the <i>groups</i> matched if
- * valid or <code>null</code> if invalid
+ * valid or <code>null</code> if invalid
*/
public String[] match(String value) {
if (value == null) {
@@ -180,7 +182,7 @@ public class RegexValidator implements S
int count = matcher.groupCount();
if (count == 1) {
return matcher.group(1);
- }
+ }
StringBuffer buffer = new StringBuffer();
for (int j = 0; j < count; j++) {
String component = matcher.group(j+1);
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ShortValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ShortValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ShortValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/ShortValidator.java Thu Jan 5 17:45:51 2012
@@ -32,11 +32,11 @@ import java.util.Locale;
* <li>using the default format for a specified <code>Locale</code></li>
* <li>using a specified pattern with a specified <code>Locale</code></li>
* </ul>
- *
+ *
* <p>Use one of the <code>isValid()</code> methods to just validate or
* one of the <code>validate()</code> methods to validate and receive a
* <i>converted</i> <code>Short</code> value.</p>
- *
+ *
* <p>Once a value has been sucessfully converted the following
* methods can be used to perform minimum, maximum and range checks:</p>
* <ul>
@@ -47,10 +47,10 @@ import java.util.Locale;
* <li><code>isInRange()</code> checks whether the value is within
* a specified range of values.</li>
* </ul>
- *
- * <p>So that the same mechanism used for parsing an <i>input</i> value
+ *
+ * <p>So that the same mechanism used for parsing an <i>input</i> value
* for validation can be used to format <i>output</i>, corresponding
- * <code>format()</code> methods are also provided. That is you can
+ * <code>format()</code> methods are also provided. That is you can
* format either:</p>
* <ul>
* <li>using the default format for the default <code>Locale</code></li>
@@ -64,6 +64,8 @@ import java.util.Locale;
*/
public class ShortValidator extends AbstractNumberValidator {
+ private static final long serialVersionUID = -5227510699747787066L;
+
private static final ShortValidator VALIDATOR = new ShortValidator();
/**
@@ -84,7 +86,7 @@ public class ShortValidator extends Abst
/**
* <p>Construct an instance with the specified strict setting
* and format type.</p>
- *
+ *
* <p>The <code>formatType</code> specified what type of
* <code>NumberFormat</code> is created - valid types
* are:</p>
@@ -96,8 +98,8 @@ public class ShortValidator extends Abst
* <li>AbstractNumberValidator.PERCENT_FORMAT -to create
* <i>percent</i> number formats (the default).</li>
* </ul>
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param formatType The <code>NumberFormat</code> type to
* create for validation, default is STANDARD_FORMAT.
@@ -108,7 +110,7 @@ public class ShortValidator extends Abst
/**
* <p>Validate/convert a <code>Short</code> using the default
- * <code>Locale</code>.
+ * <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @return The parsed <code>Short</code> if valid or <code>null</code>
@@ -120,7 +122,7 @@ public class ShortValidator extends Abst
/**
* <p>Validate/convert a <code>Short</code> using the
- * specified <i>pattern</i>.
+ * specified <i>pattern</i>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
@@ -132,7 +134,7 @@ public class ShortValidator extends Abst
/**
* <p>Validate/convert a <code>Short</code> using the
- * specified <code>Locale</code>.
+ * specified <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param locale The locale to use for the number format, system default if null.
@@ -144,7 +146,7 @@ public class ShortValidator extends Abst
/**
* <p>Validate/convert a <code>Short</code> using the
- * specified pattern and/ or <code>Locale</code>.
+ * specified pattern and/ or <code>Locale</code>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against, or the
@@ -158,7 +160,7 @@ public class ShortValidator extends Abst
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -171,7 +173,7 @@ public class ShortValidator extends Abst
/**
* Check if the value is within a specified range.
- *
+ *
* @param value The <code>Number</code> value to check.
* @param min The minimum value of the range.
* @param max The maximum value of the range.
@@ -184,7 +186,7 @@ public class ShortValidator extends Abst
/**
* Check 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</code> if the value is greater than
@@ -196,7 +198,7 @@ public class ShortValidator extends Abst
/**
* Check 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</code> if the value is greater than
@@ -208,7 +210,7 @@ public class ShortValidator extends Abst
/**
* Check 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</code> if the value is less than
@@ -220,7 +222,7 @@ public class ShortValidator extends Abst
/**
* Check 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</code> if the value is less than
@@ -233,17 +235,17 @@ public class ShortValidator extends Abst
/**
* <p>Perform further validation and convert the <code>Number</code> to
* a <code>Short</code>.</p>
- *
+ *
* @param value The parsed <code>Number</code> object created.
* @param formatter The Format used to parse the value with.
- * @return The parsed <code>Number</code> converted to a
+ * @return The parsed <code>Number</code> converted to a
* <code>Short</code> if valid or <code>null</code> if invalid.
*/
protected Object processParsedValue(Object value, Format formatter) {
long longValue = ((Number)value).longValue();
- if (longValue < Short.MIN_VALUE ||
+ if (longValue < Short.MIN_VALUE ||
longValue > Short.MAX_VALUE) {
return null;
} else {
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/TimeValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/TimeValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/TimeValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/TimeValidator.java Thu Jan 5 17:45:51 2012
@@ -26,7 +26,7 @@ import java.util.TimeZone;
* <p><b>Time Validation</b> and Conversion routines (<code>java.util.Calendar</code>).</p>
*
* <p>This validator provides a number of methods for validating/converting
- * a <code>String</code> time value to a <code>java.util.Calendar</code> using
+ * a <code>String</code> time value to a <code>java.util.Calendar</code> using
* <code>java.text.DateFormat</code> to parse either:</p>
* <ul>
* <li>using the default format for the default <code>Locale</code></li>
@@ -34,12 +34,12 @@ import java.util.TimeZone;
* <li>using the default format for a specified <code>Locale</code></li>
* <li>using a specified pattern with a specified <code>Locale</code></li>
* </ul>
- *
- * <p>For each of the above mechanisms, conversion method (i.e the
+ *
+ * <p>For each of the above mechanisms, conversion method (i.e the
* <code>validate</code> methods) implementations are provided which
- * either use the default <code>TimeZone</code> or allow the
+ * either use the default <code>TimeZone</code> or allow the
* <code>TimeZone</code> to be specified.</p>
- *
+ *
* <p>Use one of the <code>isValid()</code> methods to just validate or
* one of the <code>validate()</code> methods to validate and receive a
* <i>converted</i> <code>Calendar</code> value for the time.</p>
@@ -47,11 +47,11 @@ import java.util.TimeZone;
* <p>Implementations of the <code>validate()</code> method are provided
* to create <code>Calendar</code> objects for different <i>time zones</i>
* if the system default is not appropriate.</p>
- *
+ *
* <p>Alternatively the CalendarValidator's <code>adjustToTimeZone()</code> method
* can be used to adjust the <code>TimeZone</code> of the <code>Calendar</code>
- * object afterwards.</p>
- *
+ * object afterwards.</p>
+ *
* <p>Once a value has been sucessfully converted the following
* methods can be used to perform various time comparison checks:</p>
* <ul>
@@ -68,10 +68,10 @@ import java.util.TimeZone;
* of two times, returing 0, -1 or +1 indicating
* whether the first is equal to, before or after the second.</li>
* </ul>
- *
- * <p>So that the same mechanism used for parsing an <i>input</i> value
+ *
+ * <p>So that the same mechanism used for parsing an <i>input</i> value
* for validation can be used to format <i>output</i>, corresponding
- * <code>format()</code> methods are also provided. That is you can
+ * <code>format()</code> methods are also provided. That is you can
* format either:</p>
* <ul>
* <li>using a specified pattern</li>
@@ -84,6 +84,8 @@ import java.util.TimeZone;
*/
public class TimeValidator extends AbstractCalendarValidator {
+ private static final long serialVersionUID = 3494007492269691581L;
+
private static final TimeValidator VALIDATOR = new TimeValidator();
/**
@@ -105,8 +107,8 @@ public class TimeValidator extends Abstr
/**
* Construct an instance with the specified <i>strict</i>
* and <i>time style</i> parameters.
- *
- * @param strict <code>true</code> if strict
+ *
+ * @param strict <code>true</code> if strict
* <code>Format</code> parsing should be used.
* @param timeStyle the time style to use for Locale validation.
*/
@@ -116,7 +118,7 @@ public class TimeValidator extends Abstr
/**
* <p>Validate/convert a time using the default <code>Locale</code>
- * and <code>TimeZone</code>.
+ * and <code>TimeZone</code>.
*
* @param value The value validation is being performed on.
* @return The parsed <code>Calendar</code> if valid or <code>null</code>
@@ -219,7 +221,7 @@ public class TimeValidator extends Abstr
/**
* <p>Compare Times (hour, minute, second and millisecond - not date).</p>
- *
+ *
* @param value The <code>Calendar</code> value to check.
* @param compare The <code>Calendar</code> to compare the value to.
* @return Zero if the hours are equal, -1 if first
@@ -232,7 +234,7 @@ public class TimeValidator extends Abstr
/**
* <p>Compare Seconds (hours, minutes and seconds).</p>
- *
+ *
* @param value The <code>Calendar</code> value to check.
* @param compare The <code>Calendar</code> to compare the value to.
* @return Zero if the hours are equal, -1 if first
@@ -245,7 +247,7 @@ public class TimeValidator extends Abstr
/**
* <p>Compare Minutes (hours and minutes).</p>
- *
+ *
* @param value The <code>Calendar</code> value to check.
* @param compare The <code>Calendar</code> to compare the value to.
* @return Zero if the hours are equal, -1 if first
@@ -258,7 +260,7 @@ public class TimeValidator extends Abstr
/**
* <p>Compare Hours.</p>
- *
+ *
* @param value The <code>Calendar</code> value to check.
* @param compare The <code>Calendar</code> to compare the value to.
* @return Zero if the hours are equal, -1 if first
@@ -271,7 +273,7 @@ public class TimeValidator extends Abstr
/**
* <p>Convert the parsed <code>Date</code> to a <code>Calendar</code>.</p>
- *
+ *
* @param value The parsed <code>Date</code> object created.
* @param formatter The Format used to parse the value with.
* @return The parsed value converted to a <code>Calendar</code>.
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/UrlValidator.java Thu Jan 5 17:45:51 2012
@@ -72,6 +72,8 @@ import java.util.regex.Pattern;
*/
public class UrlValidator implements Serializable {
+ private static final long serialVersionUID = 7557161713937335013L;
+
/**
* Allows all validly formatted schemes to pass validation instead of
* supplying a set of valid schemes.
@@ -87,12 +89,12 @@ public class UrlValidator implements Ser
* Enabling this options disallows any URL fragments.
*/
public static final long NO_FRAGMENTS = 1 << 2;
-
+
/**
* Allow local URLs, such as http://localhost/ or http://machine/ .
- * This enables a broad-brush check, for complex local machine name
+ * This enables a broad-brush check, for complex local machine name
* validation requirements you should create your validator with
- * a {@link RegexValidator} instead ({@link #UrlValidator(RegexValidator, long)})
+ * a {@link RegexValidator} instead ({@link #UrlValidator(RegexValidator, long)})
*/
public static final long ALLOW_LOCAL_URLS = 1 << 3;
@@ -186,7 +188,7 @@ public class UrlValidator implements Ser
* @return singleton instance with default schemes and options
*/
public static UrlValidator getInstance() {
- return DEFAULT_URL_VALIDATOR;
+ return DEFAULT_URL_VALIDATOR;
}
/**
@@ -294,7 +296,7 @@ public class UrlValidator implements Ser
return false;
}
- String authority = urlMatcher.group(PARSE_URL_AUTHORITY);
+ String authority = urlMatcher.group(PARSE_URL_AUTHORITY);
if ("file".equals(scheme) && "".equals(authority)) {
// Special case - file: allows an empty authority
} else {
@@ -474,7 +476,7 @@ public class UrlValidator implements Ser
}
/**
- * Tests whether the given flag is on. If the flag is not a power of 2
+ * Tests whether the given flag is on. If the flag is not a power of 2
* (ie. 3) this tests whether the combination of flags is on.
*
* @param flag Flag value to check.
@@ -486,7 +488,7 @@ public class UrlValidator implements Ser
}
/**
- * Tests whether the given flag is off. If the flag is not a power of 2
+ * Tests whether the given flag is off. If the flag is not a power of 2
* (ie. 3) this tests whether the combination of flags is off.
*
* @param flag Flag value to check.
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ABANumberCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ABANumberCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ABANumberCheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ABANumberCheckDigit.java Thu Jan 5 17:45:51 2012
@@ -33,14 +33,16 @@ package org.apache.commons.validator.rou
* </ul>
* <p>
* For further information see
- * <a href="http://en.wikipedia.org/wiki/Routing_transit_number">Wikipedia -
+ * <a href="http://en.wikipedia.org/wiki/Routing_transit_number">Wikipedia -
* Routing transit number</a>.
- *
+ *
* @version $Revision$ $Date$
* @since Validator 1.4
*/
public final class ABANumberCheckDigit extends ModulusCheckDigit {
+ private static final long serialVersionUID = -8255937433810380145L;
+
/** Singleton Routing Transit Number Check Digit instance */
public static final CheckDigit ABAN_CHECK_DIGIT = new ABANumberCheckDigit();
@@ -65,7 +67,7 @@ public final class ABANumberCheckDigit e
* </code></pre>
*
* @param charValue The numeric value of the character.
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The weighted value of the character.
*/
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CUSIPCheckDigit.java Thu Jan 5 17:45:51 2012
@@ -38,6 +38,8 @@ package org.apache.commons.validator.rou
*/
public final class CUSIPCheckDigit extends ModulusCheckDigit {
+ private static final long serialVersionUID = 666941918490152456L;
+
/** Singleton CUSIP Check Digit instance */
public static final CheckDigit CUSIP_CHECK_DIGIT = new CUSIPCheckDigit();
@@ -55,7 +57,7 @@ public final class CUSIPCheckDigit exten
* Convert a character at a specified position to an integer value.
*
* @param character The character to convert
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The integer value of the character
* @throws CheckDigitException if character is not alphanumeric
@@ -64,7 +66,7 @@ public final class CUSIPCheckDigit exten
throws CheckDigitException {
int charValue = Character.getNumericValue(character);
if (charValue < 0 || charValue > 35) {
- throw new CheckDigitException("Invalid Character[" +
+ throw new CheckDigitException("Invalid Character[" +
leftPos + "] = '" + charValue + "'");
}
return charValue;
@@ -79,7 +81,7 @@ public final class CUSIPCheckDigit exten
* of <b>two</b>. Weighted values > 9, have 9 subtracted</p>
*
* @param charValue The numeric value of the character.
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The weighted value of the character.
*/
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigitException.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigitException.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigitException.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/CheckDigitException.java Thu Jan 5 17:45:51 2012
@@ -24,6 +24,8 @@ package org.apache.commons.validator.rou
*/
public class CheckDigitException extends Exception {
+ private static final long serialVersionUID = -3519894732624685477L;
+
/**
* Construct an Exception with no message.
*/
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/EAN13CheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/EAN13CheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/EAN13CheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/EAN13CheckDigit.java Thu Jan 5 17:45:51 2012
@@ -26,13 +26,13 @@ package org.apache.commons.validator.rou
* <p>
* For further information see:
* <ul>
- * <li>EAN-13 - see
- * <a href="http://en.wikipedia.org/wiki/European_Article_Number">Wikipedia -
+ * <li>EAN-13 - see
+ * <a href="http://en.wikipedia.org/wiki/European_Article_Number">Wikipedia -
* European Article Number</a>.</li>
* <li>UPC - see
* <a href="http://en.wikipedia.org/wiki/Universal_Product_Code">Wikipedia -
* Universal Product Code</a>.</li>
- * <li>ISBN-13 - see
+ * <li>ISBN-13 - see
* <a href="http://en.wikipedia.org/wiki/ISBN">Wikipedia - International
* Standard Book Number (ISBN)</a>.</li>
* </ul>
@@ -42,6 +42,8 @@ package org.apache.commons.validator.rou
*/
public final class EAN13CheckDigit extends ModulusCheckDigit {
+ private static final long serialVersionUID = 1726347093230424107L;
+
/** Singleton EAN-13 Check Digit instance */
public static final CheckDigit EAN13_CHECK_DIGIT = new EAN13CheckDigit();
@@ -64,7 +66,7 @@ public final class EAN13CheckDigit exten
* of <b>three</b>.</p>
*
* @param charValue The numeric value of the character.
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The weighted value of the character.
*/
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java Thu Jan 5 17:45:51 2012
@@ -32,7 +32,7 @@ import java.io.Serializable;
* <code>CC00nnnnnnn</code> in this example.
* <p>
* For further information see
- * <a href="http://en.wikipedia.org/wiki/International_Bank_Account_Number">Wikipedia -
+ * <a href="http://en.wikipedia.org/wiki/International_Bank_Account_Number">Wikipedia -
* IBAN number</a>.
*
* @version $Revision$ $Date$
@@ -40,12 +40,14 @@ import java.io.Serializable;
*/
public final class IBANCheckDigit implements CheckDigit, Serializable {
+ private static final long serialVersionUID = -3600191725934382801L;
+
/** Singleton IBAN Number Check Digit instance */
public static final CheckDigit IBAN_CHECK_DIGIT = new IBANCheckDigit();
- private static final long MAX = 999999999;
+ private static final long MAX = 999999999;
- private static final long MODULUS = 97;
+ private static final long MODULUS = 97;
/**
* Construct Check Digit routine for IBAN Numbers.
@@ -64,7 +66,7 @@ public final class IBANCheckDigit implem
if (code == null || code.length() < 5) {
return false;
}
- try {
+ try {
int modulusResult = calculateModulus(code);
return (modulusResult == 1);
} catch (CheckDigitException ex) {
@@ -108,7 +110,7 @@ public final class IBANCheckDigit implem
for (int i = 0; i < reformattedCode.length(); i++) {
int charValue = Character.getNumericValue(reformattedCode.charAt(i));
if (charValue < 0 || charValue > 35) {
- throw new CheckDigitException("Invalid Character[" +
+ throw new CheckDigitException("Invalid Character[" +
i + "] = '" + charValue + "'");
}
total = (charValue > 9 ? total * 100 : total * 10) + charValue;
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBN10CheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBN10CheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBN10CheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBN10CheckDigit.java Thu Jan 5 17:45:51 2012
@@ -44,6 +44,8 @@ package org.apache.commons.validator.rou
*/
public final class ISBN10CheckDigit extends ModulusCheckDigit {
+ private static final long serialVersionUID = 8000855044504864964L;
+
/** Singleton ISBN-10 Check Digit instance */
public static final CheckDigit ISBN10_CHECK_DIGIT = new ISBN10CheckDigit();
@@ -62,7 +64,7 @@ public final class ISBN10CheckDigit exte
* by their position.</p>
*
* @param charValue The numeric value of the character.
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The weighted value of the character.
*/
@@ -77,7 +79,7 @@ public final class ISBN10CheckDigit exte
* <p>Character 'X' check digit converted to 10.</p>
*
* @param character The character to convert.
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The integer value of the character.
* @throws CheckDigitException if an error occurs.
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISBNCheckDigit.java Thu Jan 5 17:45:51 2012
@@ -36,6 +36,8 @@ import java.io.Serializable;
*/
public final class ISBNCheckDigit implements CheckDigit, Serializable {
+ private static final long serialVersionUID = 1391849166205184558L;
+
/** Singleton ISBN-10 Check Digit instance */
public static final CheckDigit ISBN10_CHECK_DIGIT = ISBN10CheckDigit.ISBN10_CHECK_DIGIT;
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ISINCheckDigit.java Thu Jan 5 17:45:51 2012
@@ -36,6 +36,8 @@ package org.apache.commons.validator.rou
*/
public final class ISINCheckDigit extends ModulusCheckDigit {
+ private static final long serialVersionUID = -1239211208101323599L;
+
/** Singleton ISIN Check Digit instance */
public static final CheckDigit ISIN_CHECK_DIGIT = new ISINCheckDigit();
@@ -63,7 +65,7 @@ public final class ISINCheckDigit extend
for (int i = 0; i < code.length(); i++) {
int charValue = Character.getNumericValue(code.charAt(i));
if (charValue < 0 || charValue > 35) {
- throw new CheckDigitException("Invalid Character[" +
+ throw new CheckDigitException("Invalid Character[" +
(i + 1) + "] = '" + charValue + "'");
}
transformed.append(charValue);
@@ -80,7 +82,7 @@ public final class ISINCheckDigit extend
* of <b>two</b>. Weighted values > 9, have 9 subtracted</p>
*
* @param charValue The numeric value of the character.
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The weighted value of the character.
*/
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/LuhnCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/LuhnCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/LuhnCheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/LuhnCheckDigit.java Thu Jan 5 17:45:51 2012
@@ -37,6 +37,8 @@ package org.apache.commons.validator.rou
*/
public final class LuhnCheckDigit extends ModulusCheckDigit {
+ private static final long serialVersionUID = -2976900113942875999L;
+
/** Singleton Luhn Check Digit instance */
public static final CheckDigit LUHN_CHECK_DIGIT = new LuhnCheckDigit();
@@ -59,7 +61,7 @@ public final class LuhnCheckDigit extend
* of <b>two</b>. Weighted values > 9, have 9 subtracted</p>
*
* @param charValue The numeric value of the character.
- * @param leftPos The position of the character in the code, counting from left to right
+ * @param leftPos The position of the character in the code, counting from left to right
* @param rightPos The positionof the character in the code, counting from right to left
* @return The weighted value of the character.
*/