You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ni...@apache.org on 2005/09/15 02:07:18 UTC
svn commit: r280974 - in
/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator:
./ util/
Author: niallp
Date: Wed Sep 14 17:06:59 2005
New Revision: 280974
URL: http://svn.apache.org/viewcvs?rev=280974&view=rev
Log:
Correct javadocs as per checkstyle report
Modified:
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Arg.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/CreditCardValidator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ISBNValidator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Msg.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/UrlValidator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResult.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResults.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Var.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/Flags.java
jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Arg.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Arg.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Arg.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Arg.java Wed Sep 14 17:06:59 2005
@@ -86,6 +86,7 @@
/**
* Returns the resource bundle name.
+ * @return the bundle name.
* @since Validator 1.1
*/
public String getBundle() {
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/CreditCardValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/CreditCardValidator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/CreditCardValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/CreditCardValidator.java Wed Sep 14 17:06:59 2005
@@ -123,6 +123,7 @@
/**
* Checks if the field is a valid credit card number.
* @param card The card number to validate.
+ * @return Whether the card number is valid.
*/
public boolean isValid(String card) {
if ((card == null) || (card.length() < 13) || (card.length() > 19)) {
@@ -157,6 +158,7 @@
/**
* Checks for a valid credit card number.
* @param cardNumber Credit Card Number.
+ * @return Whether the card number passes the luhnCheck.
*/
protected boolean luhnCheck(String cardNumber) {
// number must be validated as 0..9 numeric first!!
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/DateValidator.java Wed Sep 14 17:06:59 2005
@@ -44,6 +44,7 @@
/**
* Returns the Singleton instance of this validator.
+ * @return A singleton instance of the DateValidator.
*/
public static DateValidator getInstance() {
return instance;
@@ -66,6 +67,7 @@
* @param value The value validation is being performed on.
* @param datePattern The pattern passed to <code>SimpleDateFormat</code>.
* @param strict Whether or not to have an exact match of the datePattern.
+ * @return true if the date is valid.
*/
public boolean isValid(String value, String datePattern, boolean strict) {
@@ -100,6 +102,7 @@
* @param value The value validation is being performed on.
* @param locale The locale to use for the date format, defaults to the default
* system default if null.
+ * @return true if the date is valid.
*/
public boolean isValid(String value, Locale locale) {
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/EmailValidator.java Wed Sep 14 17:06:59 2005
@@ -65,6 +65,7 @@
/**
* Returns the Singleton instance of this validator.
+ * @return singleton instance of this validator.
*/
public static EmailValidator getInstance() {
return instance;
@@ -82,6 +83,7 @@
*
* @param email The value validation is being performed on. A <code>null</code>
* value is considered invalid.
+ * @return true if the email address is valid.
*/
public boolean isValid(String email) {
if (email == null) {
@@ -119,6 +121,7 @@
/**
* Returns true if the domain component of an email address is valid.
* @param domain being validatied.
+ * @return true if the email address's domain is valid.
*/
protected boolean isValidDomain(String domain) {
boolean symbolic = false;
@@ -150,6 +153,7 @@
/**
* Returns true if the user component of an email address is valid.
* @param user being validated
+ * @return true if the user name is valid.
*/
protected boolean isValidUser(String user) {
Perl5Util userMatcher = new Perl5Util();
@@ -159,6 +163,7 @@
/**
* Validates an IP address. Returns true if valid.
* @param ipAddressMatcher Pattren matcher
+ * @return true if the ip address is valid.
*/
protected boolean isValidIpAddress(Perl5Util ipAddressMatcher) {
for (int i = 1; i <= 4; i++) {
@@ -186,6 +191,7 @@
/**
* Validates a symbolic domain name. Returns true if it's valid.
* @param domain symbolic domain name
+ * @return true if the symbolic domain name is valid.
*/
protected boolean isValidSymbolicDomain(String domain) {
String[] domainSegment = new String[10];
@@ -232,6 +238,8 @@
* regexps in the Email Addressing FAQ are imperfect - they will miss escaped
* chars in atoms, for example.
* Derived From Mail::RFC822::Address
+ * @param emailStr The email address
+ * @return address with comments removed.
*/
protected String stripComments(String emailStr) {
String input = emailStr;
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java Wed Sep 14 17:06:59 2005
@@ -61,13 +61,39 @@
*/
public static final String TOKEN_INDEXED = "[]";
+ /**
+ * The start of a token.
+ */
protected static final String TOKEN_START = "${";
+
+ /**
+ * The end of a token.
+ */
protected static final String TOKEN_END = "}";
+
+ /**
+ * A Vriable token.
+ */
protected static final String TOKEN_VAR = "var:";
+ /**
+ * The Field's property name.
+ */
protected String property = null;
+
+ /**
+ * The Field's indexed property name.
+ */
protected String indexedProperty = null;
+
+ /**
+ * The Field's indexed list property name.
+ */
protected String indexedListProperty = null;
+
+ /**
+ * The Field's unique key.
+ */
protected String key = null;
/**
@@ -75,8 +101,14 @@
*/
protected String depends = null;
+ /**
+ * The Page Number
+ */
protected int page = 0;
+ /**
+ * The order of the Field in the Form.
+ */
protected int fieldOrder = 0;
/**
@@ -108,6 +140,7 @@
/**
* Gets the page value that the Field is associated with for
* validation.
+ * @return The page number.
*/
public int getPage() {
return this.page;
@@ -116,6 +149,7 @@
/**
* Sets the page value that the Field is associated with for
* validation.
+ * @param page The page number.
*/
public void setPage(int page) {
this.page = page;
@@ -123,6 +157,7 @@
/**
* Gets the position of the <code>Field</code> in the validation list.
+ * @return The field position.
*/
public int getFieldOrder() {
return this.fieldOrder;
@@ -130,6 +165,7 @@
/**
* Sets the position of the <code>Field</code> in the validation list.
+ * @param fieldOrder The field position.
*/
public void setFieldOrder(int fieldOrder) {
this.fieldOrder = fieldOrder;
@@ -137,6 +173,7 @@
/**
* Gets the property name of the field.
+ * @return The field's property name.
*/
public String getProperty() {
return this.property;
@@ -144,6 +181,7 @@
/**
* Sets the property name of the field.
+ * @param property The field's property name.
*/
public void setProperty(String property) {
this.property = property;
@@ -153,6 +191,7 @@
* Gets the indexed property name of the field. This
* is the method name that can take an <code>int</code> as
* a parameter for indexed property value retrieval.
+ * @return The field's indexed property name.
*/
public String getIndexedProperty() {
return this.indexedProperty;
@@ -160,6 +199,7 @@
/**
* Sets the indexed property name of the field.
+ * @param indexedProperty The field's indexed property name.
*/
public void setIndexedProperty(String indexedProperty) {
this.indexedProperty = indexedProperty;
@@ -171,6 +211,7 @@
* <code>Collection</code> used to retrieve the
* list and then loop through the list performing the specified
* validations.
+ * @return The field's indexed List property name.
*/
public String getIndexedListProperty() {
return this.indexedListProperty;
@@ -178,6 +219,7 @@
/**
* Sets the indexed property name of the field.
+ * @param indexedListProperty The field's indexed List property name.
*/
public void setIndexedListProperty(String indexedListProperty) {
this.indexedListProperty = indexedListProperty;
@@ -185,6 +227,7 @@
/**
* Gets the validation rules for this field as a comma separated list.
+ * @return A comma separated list of validator names.
*/
public String getDepends() {
return this.depends;
@@ -211,6 +254,7 @@
/**
* Add a <code>Msg</code> to the <code>Field</code>.
+ * @param msg A validation message.
*/
public void addMsg(Msg msg) {
hMsgs.put(msg.getName(), msg);
@@ -218,6 +262,8 @@
/**
* Retrieve a message value.
+ * @param key Validation key.
+ * @return A validation message for a specified validator.
*/
public String getMsg(String key) {
Msg msg = getMessage(key);
@@ -227,6 +273,8 @@
/**
* Retrieve a message object.
* @since Validator 1.1.4
+ * @param key Validation key.
+ * @return A validation message for a specified validator.
*/
public Msg getMessage(String key) {
return (Msg) hMsgs.get(key);
@@ -236,6 +284,7 @@
* The <code>Field</code>'s messages are returned as an
* unmodifiable <code>Map</code>.
* @since Validator 1.1.4
+ * @return Map of validation messages for the field.
*/
public Map getMessages() {
return Collections.unmodifiableMap(hMsgs);
@@ -244,6 +293,7 @@
/**
* Add an <code>Arg</code> to the replacement argument list.
* @since Validator 1.1
+ * @param arg Validation message's argument.
*/
public void addArg(Arg arg) {
// TODO this first if check can go away after arg0, etc. are removed from dtd
@@ -325,6 +375,7 @@
/**
* Gets the default <code>Arg</code> object at the given position.
+ * @param position Validation message argument's position.
* @return The default Arg or null if not found.
* @since Validator 1.1
*/
@@ -369,14 +420,15 @@
Arg[] args = new Arg[this.args.length];
for (int i = 0; i < this.args.length; i++) {
- args[i] = this.getArg(key, i);
- }
+ args[i] = this.getArg(key, i);
+ }
return args;
}
/**
* Add a <code>Var</code> to the <code>Field</code>.
+ * @param v The Validator Argument.
*/
public void addVar(Var v) {
this.hVars.put(v.getName(), v);
@@ -385,9 +437,9 @@
/**
* Add a <code>Var</code>, based on the values passed in, to the
* <code>Field</code>.
- * @param name
- * @param value
- * @param jsType
+ * @param name Name of the validation.
+ * @param value The Argument's value.
+ * @param jsType The Javascript type.
*/
public void addVar(String name, String value, String jsType) {
this.addVar(new Var(name, value, jsType));
@@ -395,7 +447,8 @@
/**
* Retrieve a variable.
- * @param mainKey
+ * @param mainKey The Variable's key
+ * @return the Variable
*/
public Var getVar(String mainKey) {
return (Var) hVars.get(mainKey);
@@ -403,7 +456,8 @@
/**
* Retrieve a variable's value.
- * @param mainKey
+ * @param mainKey The Variable's key
+ * @return the Variable's value
*/
public String getVarValue(String mainKey) {
String value = null;
@@ -420,6 +474,7 @@
/**
* The <code>Field</code>'s variables are returned as an
* unmodifiable <code>Map</code>.
+ * @return the Map of Variable's for a Field.
*/
public Map getVars() {
return Collections.unmodifiableMap(hVars);
@@ -427,6 +482,7 @@
/**
* Gets a unique key based on the property and indexedProperty fields.
+ * @return a unique key for the field.
*/
public String getKey() {
if (this.key == null) {
@@ -439,7 +495,7 @@
/**
* Sets a unique key for the field. This can be used to change
* the key temporarily to have a unique key for an indexed field.
- * @param key
+ * @param key a unique key for the field
*/
public void setKey(String key) {
this.key = key;
@@ -449,6 +505,7 @@
* If there is a value specified for the indexedProperty field then
* <code>true</code> will be returned. Otherwise it will be
* <code>false</code>.
+ * @return Whether the Field is indexed.
*/
public boolean isIndexed() {
return ((indexedListProperty != null && indexedListProperty.length() > 0));
@@ -570,6 +627,8 @@
/**
* Checks if the validator is listed as a dependency.
+ * @param validatorName Name of the validator to check.
+ * @return Whether the field is dependant on a validator.
*/
public boolean isDependency(String validatorName) {
return this.dependencyList.contains(validatorName);
@@ -578,6 +637,7 @@
/**
* Gets an unmodifiable <code>List</code> of the dependencies in the same
* order they were defined in parameter passed to the setDepends() method.
+ * @return A list of the Field's dependancies.
*/
public List getDependencyList() {
return Collections.unmodifiableList(this.dependencyList);
@@ -585,6 +645,7 @@
/**
* Creates and returns a copy of this object.
+ * @return A copy of the Field.
*/
public Object clone() {
Field field = null;
@@ -618,6 +679,7 @@
/**
* Returns a string representation of the object.
+ * @return A string representation of the object.
*/
public String toString() {
StringBuffer results = new StringBuffer();
@@ -712,7 +774,7 @@
* @param actions
* @param pos
* @return true if all of the dependent validations passed.
- * @throws ValidatorException
+ * @throws ValidatorException If there's an error running a validator
*/
private boolean runDependentValidators(
ValidatorAction va,
@@ -808,6 +870,7 @@
/**
* Returns a Map of String Msg names to Msg objects.
* @since Validator 1.2.0
+ * @return A Map of the Field's messages.
*/
protected Map getMsgMap() {
return hMsgs;
@@ -816,6 +879,7 @@
/**
* Returns a Map of String Var names to Var objects.
* @since Validator 1.2.0
+ * @return A Map of the Field's variables.
*/
protected Map getVarMap() {
return hVars;
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java Wed Sep 14 17:06:59 2005
@@ -211,7 +211,7 @@
/**
* Returns a string representation of the object.
*
- * @return
+ * @return string representation
*/
public String toString() {
StringBuffer results = new StringBuffer();
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericTypeValidator.java Wed Sep 14 17:06:59 2005
@@ -43,7 +43,7 @@
* Checks if the value can safely be converted to a byte primitive.
*
*@param value The value validation is being performed on.
- *@return
+ *@return the converted Byte value.
*/
public static Byte formatByte(String value) {
if (value == null) {
@@ -64,7 +64,7 @@
*@param value The value validation is being performed on.
*@param locale The locale to use to parse the number (system default if
* null)
- *@return
+ *@return the converted Byte value.
*/
public static Byte formatByte(String value, Locale locale) {
Byte result = null;
@@ -95,7 +95,7 @@
* Checks if the value can safely be converted to a short primitive.
*
*@param value The value validation is being performed on.
- *@return
+ *@return the converted Short value.
*/
public static Short formatShort(String value) {
if (value == null) {
@@ -116,7 +116,7 @@
*@param value The value validation is being performed on.
*@param locale The locale to use to parse the number (system default if
* null)vv
- *@return
+ *@return the converted Short value.
*/
public static Short formatShort(String value, Locale locale) {
Short result = null;
@@ -147,7 +147,7 @@
* Checks if the value can safely be converted to a int primitive.
*
*@param value The value validation is being performed on.
- *@return
+ *@return the converted Integer value.
*/
public static Integer formatInt(String value) {
if (value == null) {
@@ -168,7 +168,7 @@
*@param value The value validation is being performed on.
*@param locale The locale to use to parse the number (system default if
* null)
- *@return
+ *@return the converted Integer value.
*/
public static Integer formatInt(String value, Locale locale) {
Integer result = null;
@@ -199,7 +199,7 @@
* Checks if the value can safely be converted to a long primitive.
*
*@param value The value validation is being performed on.
- *@return
+ *@return the converted Long value.
*/
public static Long formatLong(String value) {
if (value == null) {
@@ -220,7 +220,7 @@
*@param value The value validation is being performed on.
*@param locale The locale to use to parse the number (system default if
* null)
- *@return
+ *@return the converted Long value.
*/
public static Long formatLong(String value, Locale locale) {
Long result = null;
@@ -251,7 +251,7 @@
* Checks if the value can safely be converted to a float primitive.
*
*@param value The value validation is being performed on.
- *@return
+ *@return the converted Float value.
*/
public static Float formatFloat(String value) {
if (value == null) {
@@ -272,7 +272,7 @@
*@param value The value validation is being performed on.
*@param locale The locale to use to parse the number (system default if
* null)
- *@return
+ *@return the converted Float value.
*/
public static Float formatFloat(String value, Locale locale) {
Float result = null;
@@ -303,7 +303,7 @@
* Checks if the value can safely be converted to a double primitive.
*
*@param value The value validation is being performed on.
- *@return
+ *@return the converted Double value.
*/
public static Double formatDouble(String value) {
if (value == null) {
@@ -323,8 +323,8 @@
*
*@param value The value validation is being performed on.
*@param locale The locale to use to parse the number (system default if
- * null)vvv
- *@return
+ * null)
+ *@return the converted Double value.
*/
public static Double formatDouble(String value, Locale locale) {
Double result = null;
@@ -361,7 +361,7 @@
*@param value The value validation is being performed on.
*@param locale The Locale to use to parse the date (system default if
* null)
- *@return
+ *@return the converted Date value.
*/
public static Date formatDate(String value, Locale locale) {
Date date = null;
@@ -408,7 +408,7 @@
*@param datePattern The pattern passed to <code>SimpleDateFormat</code>.
*@param strict Whether or not to have an exact match of the
* datePattern.
- *@return
+ *@return the converted Date value.
*/
public static Date formatDate(String value, String datePattern, boolean strict) {
Date date = null;
@@ -450,7 +450,7 @@
* script</a> .</p>
*
*@param value The value validation is being performed on.
- *@return
+ *@return the converted Credit Card number.
*/
public static Long formatCreditCard(String value) {
return GenericValidator.isCreditCard(value) ? new Long(value) : null;
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/GenericValidator.java Wed Sep 14 17:06:59 2005
@@ -47,6 +47,7 @@
* than zero not including whitespace.</p>
*
* @param value The value validation is being performed on.
+ * @return true if blank or null.
*/
public static boolean isBlankOrNull(String value) {
return ((value == null) || (value.trim().length() == 0));
@@ -57,6 +58,7 @@
*
* @param value The value validation is being performed on.
* @param regexp The regular expression.
+ * @return true if matches the regular expression.
*/
public static boolean matchRegexp(String value, String regexp) {
if (regexp == null || regexp.length() <= 0) {
@@ -71,6 +73,7 @@
* <p>Checks if the value can safely be converted to a byte primitive.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the value can be converted to a Byte.
*/
public static boolean isByte(String value) {
return (GenericTypeValidator.formatByte(value) != null);
@@ -80,6 +83,7 @@
* <p>Checks if the value can safely be converted to a short primitive.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the value can be converted to a Short.
*/
public static boolean isShort(String value) {
return (GenericTypeValidator.formatShort(value) != null);
@@ -89,6 +93,7 @@
* <p>Checks if the value can safely be converted to a int primitive.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the value can be converted to an Integer.
*/
public static boolean isInt(String value) {
return (GenericTypeValidator.formatInt(value) != null);
@@ -98,6 +103,7 @@
* <p>Checks if the value can safely be converted to a long primitive.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the value can be converted to a Long.
*/
public static boolean isLong(String value) {
return (GenericTypeValidator.formatLong(value) != null);
@@ -107,6 +113,7 @@
* <p>Checks if the value can safely be converted to a float primitive.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the value can be converted to a Float.
*/
public static boolean isFloat(String value) {
return (GenericTypeValidator.formatFloat(value) != null);
@@ -116,6 +123,7 @@
* <p>Checks if the value can safely be converted to a double primitive.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the value can be converted to a Double.
*/
public static boolean isDouble(String value) {
return (GenericTypeValidator.formatDouble(value) != null);
@@ -129,6 +137,7 @@
* @param value The value validation is being performed on.
* @param locale The locale to use for the date format, defaults to the
* system default if null.
+ * @return true if the value can be converted to a Date.
*/
public static boolean isDate(String value, Locale locale) {
return DateValidator.getInstance().isValid(value, locale);
@@ -144,6 +153,7 @@
* @param value The value validation is being performed on.
* @param datePattern The pattern passed to <code>SimpleDateFormat</code>.
* @param strict Whether or not to have an exact match of the datePattern.
+ * @return true if the value can be converted to a Date.
*/
public static boolean isDate(String value, String datePattern, boolean strict) {
return DateValidator.getInstance().isValid(value, datePattern, strict);
@@ -156,6 +166,7 @@
* @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 true if the value is in the specified range.
*/
public static boolean isInRange(byte value, byte min, byte max) {
return ((value >= min) && (value <= max));
@@ -168,6 +179,7 @@
* @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 true if the value is in the specified range.
*/
public static boolean isInRange(int value, int min, int max) {
return ((value >= min) && (value <= max));
@@ -180,6 +192,7 @@
* @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 true if the value is in the specified range.
*/
public static boolean isInRange(float value, float min, float max) {
return ((value >= min) && (value <= max));
@@ -192,6 +205,7 @@
* @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 true if the value is in the specified range.
*/
public static boolean isInRange(short value, short min, short max) {
return ((value >= min) && (value <= max));
@@ -204,6 +218,7 @@
* @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 true if the value is in the specified range.
*/
public static boolean isInRange(long value, long min, long max) {
return ((value >= min) && (value <= max));
@@ -216,6 +231,7 @@
* @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 true if the value is in the specified range.
*/
public static boolean isInRange(double value, double min, double max) {
return ((value >= min) && (value <= max));
@@ -224,6 +240,7 @@
/**
* Checks if the field is a valid credit card number.
* @param value The value validation is being performed on.
+ * @return true if the value is valid Credit Card Number.
*/
public static boolean isCreditCard(String value) {
return creditCardValidator.isValid(value);
@@ -233,6 +250,7 @@
* <p>Checks if a field has a valid e-mail address.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the value is valid Email Address.
*/
public static boolean isEmail(String value) {
return EmailValidator.getInstance().isValid(value);
@@ -244,6 +262,7 @@
* consider using the UrlValidator directly.
*
* @param value The value validation is being performed on.
+ * @return true if the value is valid Url.
*/
public static boolean isUrl(String value) {
return urlValidator.isValid(value);
@@ -254,6 +273,7 @@
*
* @param value The value validation is being performed on.
* @param max The maximum length.
+ * @return true if the value's length is less than the specified maximum.
*/
public static boolean maxLength(String value, int max) {
return (value.length() <= max);
@@ -264,6 +284,7 @@
*
* @param value The value validation is being performed on.
* @param min The minimum length.
+ * @return true if the value's length is more than the specified minimum.
*/
public static boolean minLength(String value, int min) {
return (value.length() >= min);
@@ -276,6 +297,7 @@
*
* @param value The value validation is being performed on.
* @param min The minimum numeric value.
+ * @return true if the value is >= the specified minimum.
*/
public static boolean minValue(int value, int min) {
return (value >= min);
@@ -286,6 +308,7 @@
*
* @param value The value validation is being performed on.
* @param min The minimum numeric value.
+ * @return true if the value is >= the specified minimum.
*/
public static boolean minValue(long value, long min) {
return (value >= min);
@@ -296,6 +319,7 @@
*
* @param value The value validation is being performed on.
* @param min The minimum numeric value.
+ * @return true if the value is >= the specified minimum.
*/
public static boolean minValue(double value, double min) {
return (value >= min);
@@ -306,6 +330,7 @@
*
* @param value The value validation is being performed on.
* @param min The minimum numeric value.
+ * @return true if the value is >= the specified minimum.
*/
public static boolean minValue(float value, float min) {
return (value >= min);
@@ -316,6 +341,7 @@
*
* @param value The value validation is being performed on.
* @param max The maximum numeric value.
+ * @return true if the value is <= the specified maximum.
*/
public static boolean maxValue(int value, int max) {
return (value <= max);
@@ -326,6 +352,7 @@
*
* @param value The value validation is being performed on.
* @param max The maximum numeric value.
+ * @return true if the value is <= the specified maximum.
*/
public static boolean maxValue(long value, long max) {
return (value <= max);
@@ -336,6 +363,7 @@
*
* @param value The value validation is being performed on.
* @param max The maximum numeric value.
+ * @return true if the value is <= the specified maximum.
*/
public static boolean maxValue(double value, double max) {
return (value <= max);
@@ -346,6 +374,7 @@
*
* @param value The value validation is being performed on.
* @param max The maximum numeric value.
+ * @return true if the value is <= the specified maximum.
*/
public static boolean maxValue(float value, float max) {
return (value <= max);
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ISBNValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ISBNValidator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ISBNValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ISBNValidator.java Wed Sep 14 17:06:59 2005
@@ -47,6 +47,9 @@
private static final String ISBN_PATTERN =
"/^" + GROUP + SEP + PUBLISHER + SEP + TITLE + SEP + CHECK + "$/";
+ /**
+ * Default Constructor.
+ */
public ISBNValidator() {
super();
}
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Msg.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Msg.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Msg.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Msg.java Wed Sep 14 17:06:59 2005
@@ -58,6 +58,7 @@
/**
* Returns the resource bundle name.
+ * @return The bundle name.
* @since Validator 1.1
*/
public String getBundle() {
@@ -75,6 +76,7 @@
/**
* Gets the name of the dependency.
+ * @return The dependency name.
*/
public String getName() {
return name;
@@ -82,6 +84,7 @@
/**
* Sets the name of the dependency.
+ * @param name The dependency name.
*/
public void setName(String name) {
this.name = name;
@@ -89,6 +92,7 @@
/**
* Gets the key/value.
+ * @return The message key/value.
*/
public String getKey() {
return key;
@@ -96,6 +100,7 @@
/**
* Sets the key/value.
+ * @param key The message key/value.
*/
public void setKey(String key) {
this.key = key;
@@ -121,6 +126,7 @@
/**
* Creates and returns a copy of this object.
+ * @return A copy of the Msg.
*/
public Object clone() {
try {
@@ -133,6 +139,7 @@
/**
* Returns a string representation of the object.
+ * @return Msg String representation.
*/
public String toString() {
StringBuffer results = new StringBuffer();
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/UrlValidator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/UrlValidator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/UrlValidator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/UrlValidator.java Wed Sep 14 17:06:59 2005
@@ -309,6 +309,8 @@
/**
* Returns true if the authority is properly formatted. An authority is the combination
* of hostname and port. A <code>null</code> authority value is considered invalid.
+ * @param authority Authority value to validate.
+ * @return true if authority (hostname and port) is valid.
*/
protected boolean isValidAuthority(String authority) {
if (authority == null) {
@@ -411,6 +413,8 @@
/**
* Returns true if the path is valid. A <code>null</code> value is considered invalid.
+ * @param path Path value to validate.
+ * @return true if path is valid.
*/
protected boolean isValidPath(String path) {
if (path == null) {
@@ -441,6 +445,8 @@
/**
* Returns true if the query is null or it's a properly formatted query string.
+ * @param query Query value to validate.
+ * @return true if query is valid.
*/
protected boolean isValidQuery(String query) {
if (query == null) {
@@ -453,6 +459,8 @@
/**
* Returns true if the given fragment is null or fragments are allowed.
+ * @param fragment Fragment value to validate.
+ * @return true if fragment is valid.
*/
protected boolean isValidFragment(String fragment) {
if (fragment == null) {
@@ -464,6 +472,9 @@
/**
* Returns the number of times the token appears in the target.
+ * @param token Token value to be counted.
+ * @param target Target value to count tokens in.
+ * @return the number of tokens.
*/
protected int countToken(String token, String target) {
int tokenIndex = 0;
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Validator.java Wed Sep 14 17:06:59 2005
@@ -89,6 +89,9 @@
*/
public static final String LOCALE_PARAM = "java.util.Locale";
+ /**
+ * The Validator Resources.
+ */
protected ValidatorResources resources = null;
/**
@@ -202,6 +205,7 @@
*
* @param parameterClassName The full class name of the parameter of the
* validation method that corresponds to the value/instance passed in with it.
+ * @return value of the specified parameter.
*/
public Object getParameterValue(String parameterClassName) {
return this.parameters.get(parameterClassName);
@@ -209,6 +213,7 @@
/**
* Gets the form name which is the key to a set of validation rules.
+ * @return the name of the form.
*/
public String getFormName() {
return formName;
@@ -216,6 +221,7 @@
/**
* Sets the form name which is the key to a set of validation rules.
+ * @param formName the name of the form.
*/
public void setFormName(String formName) {
this.formName = formName;
@@ -235,6 +241,7 @@
* Gets the page. This in conjunction with the page property of
* a <code>Field<code> can control the processing of fields. If the field's
* page is less than or equal to this page value, it will be processed.
+ * @return the page number.
*/
public int getPage() {
return page;
@@ -244,6 +251,7 @@
* Sets the page. This in conjunction with the page property of
* a <code>Field<code> can control the processing of fields. If the field's page
* is less than or equal to this page value, it will be processed.
+ * @param page the page number.
*/
public void setPage(int page) {
this.page = page;
@@ -267,6 +275,7 @@
/**
* Return the boolean as to whether the context classloader should be used.
+ * @return whether the context classloader should be used.
*/
public boolean getUseContextClassLoader() {
return this.useContextClassLoader;
@@ -294,6 +303,7 @@
* <code>useContextClassLoader</code> property is set to true</li>
* <li>The class loader used to load the Digester class itself.
* </ul>
+ * @return the class loader.
*/
public ClassLoader getClassLoader() {
if (this.classLoader != null) {
@@ -352,6 +362,7 @@
/**
* Returns true if the Validator is only returning Fields that fail validation.
+ * @return whether only failed fields are returned.
*/
public boolean getOnlyReturnErrors() {
return onlyReturnErrors;
@@ -361,6 +372,7 @@
* Configures which Fields the Validator returns from the validate() method. Set this
* to true to only return Fields that failed validation. By default, validate() returns
* all fields.
+ * @param onlyReturnErrors whether only failed fields are returned.
*/
public void setOnlyReturnErrors(boolean onlyReturnErrors) {
this.onlyReturnErrors = onlyReturnErrors;
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorAction.java Wed Sep 14 17:06:59 2005
@@ -160,6 +160,7 @@
/**
* Gets the name of the validator action.
+ * @return Validator Action name.
*/
public String getName() {
return name;
@@ -167,6 +168,7 @@
/**
* Sets the name of the validator action.
+ * @param name Validator Action name.
*/
public void setName(String name) {
this.name = name;
@@ -174,6 +176,7 @@
/**
* Gets the class of the validator action.
+ * @return Class name of the validator Action.
*/
public String getClassname() {
return classname;
@@ -181,6 +184,7 @@
/**
* Sets the class of the validator action.
+ * @param classname Class name of the validator Action.
*/
public void setClassname(String classname) {
this.classname = classname;
@@ -188,6 +192,7 @@
/**
* Gets the name of method being called for the validator action.
+ * @return The method name.
*/
public String getMethod() {
return method;
@@ -195,6 +200,7 @@
/**
* Sets the name of method being called for the validator action.
+ * @param method The method name.
*/
public void setMethod(String method) {
this.method = method;
@@ -202,6 +208,7 @@
/**
* Gets the method parameters for the method.
+ * @return Method's parameters.
*/
public String getMethodParams() {
return methodParams;
@@ -229,6 +236,7 @@
/**
* Gets the dependencies of the validator action as a comma separated list
* of validator names.
+ * @return The validator action's dependencies.
*/
public String getDepends() {
return this.depends;
@@ -255,6 +263,7 @@
/**
* Gets the message associated with the validator action.
+ * @return The message for the validator action.
*/
public String getMsg() {
return msg;
@@ -262,6 +271,7 @@
/**
* Sets the message associated with the validator action.
+ * @param msg The message for the validator action.
*/
public void setMsg(String msg) {
this.msg = msg;
@@ -271,6 +281,7 @@
* Gets the Javascript function name. This is optional and can
* be used instead of validator action name for the name of the
* Javascript function/object.
+ * @return The Javascript function name.
*/
public String getJsFunctionName() {
return jsFunctionName;
@@ -280,6 +291,7 @@
* Sets the Javascript function name. This is optional and can
* be used instead of validator action name for the name of the
* Javascript function/object.
+ * @param jsFunctionName The Javascript function name.
*/
public void setJsFunctionName(String jsFunctionName) {
this.jsFunctionName = jsFunctionName;
@@ -309,6 +321,7 @@
* org.apache.commons.validator.javascript.validateTire.js
* which is the default javascript definition.
* </pre>
+ * @param jsFunction The Javascript function's fully qualified class path.
*/
public void setJsFunction(String jsFunction) {
if (javascript != null) {
@@ -321,6 +334,7 @@
/**
* Gets the Javascript equivalent of the java class and method
* associated with this action.
+ * @return The Javascript validation.
*/
public String getJavascript() {
return javascript;
@@ -329,6 +343,7 @@
/**
* Sets the Javascript equivalent of the java class and method
* associated with this action.
+ * @param javascript The Javascript validation.
*/
public void setJavascript(String javascript) {
if (jsFunction != null) {
@@ -465,6 +480,8 @@
/**
* Checks whether or not the value passed in is in the depends field.
+ * @param validatorName Name of the dependency to check.
+ * @return Whether the named validator is a dependant.
*/
public boolean isDependency(String validatorName) {
return this.dependencyList.contains(validatorName);
@@ -473,6 +490,7 @@
/**
* Returns the dependent validator names as an unmodifiable
* <code>List</code>.
+ * @return List of the validator action's depedents.
*/
public List getDependencyList() {
return Collections.unmodifiableList(this.dependencyList);
@@ -480,6 +498,7 @@
/**
* Returns a string representation of the object.
+ * @return a string representation.
*/
public String toString() {
StringBuffer results = new StringBuffer("ValidatorAction: ");
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java Wed Sep 14 17:06:59 2005
@@ -162,8 +162,8 @@
* formed.
* @since Validator 1.2
*/
- public ValidatorResources(String url) throws IOException, SAXException {
- this(new String[]{url});
+ public ValidatorResources(String uri) throws IOException, SAXException {
+ this(new String[]{uri});
}
/**
@@ -214,6 +214,7 @@
* Add a <code>FormSet</code> to this <code>ValidatorResources</code>
* object. It will be associated with the <code>Locale</code> of the
* <code>FormSet</code>.
+ * @param fs The form set to add.
* @since Validator 1.1
*/
public void addFormSet(FormSet fs) {
@@ -242,6 +243,8 @@
/**
* Add a global constant to the resource.
+ * @param name The constant name.
+ * @param value The constant value.
*/
public void addConstant(String name, String value) {
if (log.isDebugEnabled()) {
@@ -256,6 +259,7 @@
* instance of the class based on the <code>ValidatorAction</code>s
* classname and retrieves the <code>Method</code> instance and sets them
* in the <code>ValidatorAction</code>.
+ * @param va The validator action.
*/
public void addValidatorAction(ValidatorAction va) {
va.init();
@@ -269,6 +273,8 @@
/**
* Get a <code>ValidatorAction</code> based on it's name.
+ * @param key The validator action key.
+ * @return The validator action.
*/
public ValidatorAction getValidatorAction(String key) {
return (ValidatorAction) hActions.get(key);
@@ -276,6 +282,7 @@
/**
* Get an unmodifiable <code>Map</code> of the <code>ValidatorAction</code>s.
+ * @return Map of validator actions.
*/
public Map getValidatorActions() {
return Collections.unmodifiableMap(hActions);
@@ -284,6 +291,8 @@
/**
* Builds a key to store the <code>FormSet</code> under based on it's
* language, country, and variant values.
+ * @param fs The Form Set.
+ * @return generated key for a formset.
*/
protected String buildKey(FormSet fs) {
return
@@ -310,6 +319,9 @@
* <li>language</li>
* <li>default locale</li>
* </ol>
+ * @param locale The Locale.
+ * @param formKey The key for the Form.
+ * @return The validator Form.
* @since Validator 1.1
*/
public Form getForm(Locale locale, String formKey) {
@@ -327,6 +339,11 @@
* <li>language</li>
* <li>default locale</li>
* </ol>
+ * @param language The locale's language.
+ * @param country The locale's country.
+ * @param variant The locale's language variant.
+ * @param formKey The key for the Form.
+ * @return The validator Form.
* @since Validator 1.1
*/
public Form getForm(String language, String country, String variant,
@@ -435,6 +452,7 @@
/**
* Returns a Map of String locale keys to Lists of their FormSets.
+ * @return Map of Form sets
* @since Validator 1.2.0
*/
protected Map getFormSets() {
@@ -443,6 +461,7 @@
/**
* Returns a Map of String constant names to their String values.
+ * @return Map of Constants
* @since Validator 1.2.0
*/
protected Map getConstants() {
@@ -451,6 +470,7 @@
/**
* Returns a Map of String ValidatorAction names to their ValidatorAction.
+ * @return Map of Validator Actions
* @since Validator 1.2.0
*/
protected Map getActions() {
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResult.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResult.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResult.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResult.java Wed Sep 14 17:06:59 2005
@@ -47,6 +47,7 @@
/**
* Constructs a <code>ValidatorResult</code> with the associated field being
* validated.
+ * @param field Field that was validated.
*/
public ValidatorResult(Field field) {
this.field = field;
@@ -54,6 +55,8 @@
/**
* Add the result of a validator action.
+ * @param validatorName Name of the validator.
+ * @param result Whether the validation passed or failed.
*/
public void add(String validatorName, boolean result) {
this.add(validatorName, result, null);
@@ -61,26 +64,44 @@
/**
* Add the result of a validator action.
+ * @param validatorName Name of the validator.
+ * @param result Whether the validation passed or failed.
+ * @param value Value returned by the validator.
*/
public void add(String validatorName, boolean result, Object value) {
hAction.put(validatorName, new ResultStatus(result, value));
}
+ /**
+ * Indicate whether a specified validator is in the Result.
+ * @param validatorName Name of the validator.
+ * @return true if the validator is in the result.
+ */
public boolean containsAction(String validatorName) {
return hAction.containsKey(validatorName);
}
+ /**
+ * Indicate whether a specified validation passed.
+ * @param validatorName Name of the validator.
+ * @return true if the validation passed.
+ */
public boolean isValid(String validatorName) {
ResultStatus status = (ResultStatus) hAction.get(validatorName);
return (status == null) ? false : status.isValid();
}
+ /**
+ * Return a Map of the validator actions in this Result.
+ * @return Map of validator actions.
+ */
public Map getActionMap() {
return Collections.unmodifiableMap(hAction);
}
/**
* Returns the Field that was validated.
+ * @return The Field associated with this result.
*/
public Field getField() {
return this.field;
@@ -93,6 +114,11 @@
private boolean valid = false;
private Object result = null;
+ /**
+ * Construct a Result status.
+ * @param valid Whether the validator passed or failed.
+ * @param result Value returned by the validator.
+ */
public ResultStatus(boolean valid, Object result) {
this.valid = valid;
this.result = result;
@@ -100,6 +126,7 @@
/**
* Tests whether or not the validation passed.
+ * @return true if the result was good.
*/
public boolean isValid() {
return valid;
@@ -107,6 +134,7 @@
/**
* Sets whether or not the validation passed.
+ * @param valid Whether the validation passed.
*/
public void setValid(boolean valid) {
this.valid = valid;
@@ -116,6 +144,7 @@
* Gets the result returned by a validation method.
* This can be used to retrieve to the correctly
* typed value of a date validation for example.
+ * @return The value returned by the validation.
*/
public Object getResult() {
return result;
@@ -125,6 +154,7 @@
* Sets the result returned by a validation method.
* This can be used to retrieve to the correctly
* typed value of a date validation for example.
+ * @param result The value returned by the validation.
*/
public void setResult(Object result) {
this.result = result;
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResults.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResults.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResults.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResults.java Wed Sep 14 17:06:59 2005
@@ -41,6 +41,8 @@
/**
* Merge another ValidatorResults into mine.
+ *
+ * @param results ValidatorResults to merge.
*/
public void merge(ValidatorResults results) {
this.hResults.putAll(results.hResults);
@@ -48,6 +50,10 @@
/**
* Add a the result of a validator action.
+ *
+ * @param field The field validated.
+ * @param validatorName The name of the validator.
+ * @param result The result of the validation.
*/
public void add(Field field, String validatorName, boolean result) {
this.add(field, validatorName, result, null);
@@ -55,6 +61,11 @@
/**
* Add a the result of a validator action.
+ *
+ * @param field The field validated.
+ * @param validatorName The name of the validator.
+ * @param result The result of the validation.
+ * @param value The value returned by the validator.
*/
public void add(
Field field,
@@ -82,6 +93,8 @@
/**
* Return <code>true</code> if there are no messages recorded
* in this collection, or <code>false</code> otherwise.
+ *
+ * @return Whether these results are empty.
*/
public boolean isEmpty() {
return this.hResults.isEmpty();
@@ -94,6 +107,8 @@
*
* @param key The key generated from <code>Field</code> (this is often just
* the field name).
+ *
+ * @return The result of a specified key.
*/
public ValidatorResult getValidatorResult(String key) {
return (ValidatorResult) this.hResults.get(key);
@@ -111,6 +126,8 @@
/**
* Get a <code>Map</code> of any <code>Object</code>s returned from
* validation routines.
+ *
+ * @return Map of objections returned by validators.
*/
public Map getResultValueMap() {
Map results = new HashMap();
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Var.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Var.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Var.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Var.java Wed Sep 14 17:06:59 2005
@@ -63,10 +63,20 @@
*/
private String jsType = null;
+ /**
+ * Default Constructor.
+ */
public Var() {
super();
}
+ /**
+ * Constructs a variable with a specified name, value
+ * and Javascript type.
+ * @param Variable name.
+ * @param Variable value.
+ * @param Variable Javascript type.
+ */
public Var(String name, String value, String jsType) {
this.name = name;
this.value = value;
@@ -75,6 +85,7 @@
/**
* Gets the name of the variable.
+ * @return The name of the variable.
*/
public String getName() {
return this.name;
@@ -82,6 +93,7 @@
/**
* Sets the name of the variable.
+ * @param name The name of the variable.
*/
public void setName(String name) {
this.name = name;
@@ -89,6 +101,7 @@
/**
* Gets the value of the variable.
+ * @return The value of the variable.
*/
public String getValue() {
return this.value;
@@ -96,6 +109,7 @@
/**
* Sets the value of the variable.
+ * @param value The value of the variable.
*/
public void setValue(String value) {
this.value = value;
@@ -103,6 +117,7 @@
/**
* Gets the JavaScript type of the variable.
+ * @return The Javascript type of the variable.
*/
public String getJsType() {
return this.jsType;
@@ -110,6 +125,7 @@
/**
* Sets the JavaScript type of the variable.
+ * @param jsType The Javascript type of the variable.
*/
public void setJsType(String jsType) {
this.jsType = jsType;
@@ -117,6 +133,7 @@
/**
* Creates and returns a copy of this object.
+ * @return A copy of the variable.
*/
public Object clone() {
try {
@@ -129,6 +146,7 @@
/**
* Returns a string representation of the object.
+ * @return A string representation of the variable.
*/
public String toString() {
StringBuffer results = new StringBuffer();
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/Flags.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/Flags.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/Flags.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/Flags.java Wed Sep 14 17:06:59 2005
@@ -57,6 +57,8 @@
/**
* Initialize a new Flags object with the given flags.
+ *
+ * @param flags collection of boolean flags to represent.
*/
public Flags(long flags) {
super();
@@ -65,6 +67,8 @@
/**
* Returns the current flags.
+ *
+ * @return collection of boolean flags represented.
*/
public long getFlags() {
return this.flags;
@@ -73,6 +77,10 @@
/**
* 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.
+ *
+ * @return whether the specified flag value is on.
*/
public boolean isOn(long flag) {
return (this.flags & flag) > 0;
@@ -81,6 +89,10 @@
/**
* 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.
+ *
+ * @return whether the specified flag value is off.
*/
public boolean isOff(long flag) {
return (this.flags & flag) == 0;
@@ -89,6 +101,8 @@
/**
* Turns on the given flag. If the flag is not a power of 2 (ie. 3) this
* turns on multiple flags.
+ *
+ * @param flag Flag value to turn on.
*/
public void turnOn(long flag) {
this.flags |= flag;
@@ -97,6 +111,8 @@
/**
* Turns off the given flag. If the flag is not a power of 2 (ie. 3) this
* turns off multiple flags.
+ *
+ * @param flag Flag value to turn off.
*/
public void turnOff(long flag) {
this.flags &= ~flag;
@@ -126,6 +142,8 @@
/**
* Clone this Flags object.
+ *
+ * @return a copy of this object.
* @see java.lang.Object#clone()
*/
public Object clone() {
@@ -140,6 +158,8 @@
* Tests if two Flags objects are in the same state.
* @param obj object being tested
* @see java.lang.Object#equals(java.lang.Object)
+ *
+ * @return whether the objects are equal.
*/
public boolean equals(Object obj) {
if (!(obj instanceof Flags)) {
@@ -158,6 +178,8 @@
/**
* The hash code is based on the current state of the flags.
* @see java.lang.Object#hashCode()
+ *
+ * @return the hash code for this object.
*/
public int hashCode() {
return (int) this.flags;
@@ -167,6 +189,8 @@
* Returns a 64 length String with the first flag on the right and the
* 64th flag on the left. A 1 indicates the flag is on, a 0 means it's
* off.
+ *
+ * @return string representation of this object.
*/
public String toString() {
StringBuffer bin = new StringBuffer(Long.toBinaryString(this.flags));
Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java?rev=280974&r1=280973&r2=280974&view=diff
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java (original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java Wed Sep 14 17:06:59 2005
@@ -1,189 +1,198 @@
-/*
- * $Id$
- * $Rev$
- * $Date$
- *
- * ====================================================================
- * Copyright 2001-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.validator.util;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.collections.FastHashMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.validator.Arg;
-import org.apache.commons.validator.Msg;
-import org.apache.commons.validator.Var;
-
-/**
- * Basic utility methods.
- * <p>
- * The use of FastHashMap is deprecated and will be replaced in a future
- * release.
- * </p>
- */
-public class ValidatorUtils {
-
- private static final Log log = LogFactory.getLog(ValidatorUtils.class);
-
- /**
- * <p>Replace part of a <code>String</code> with another value.</p>
- *
- * @param value <code>String</code> to perform the replacement on.
- * @param key The name of the constant.
- * @param replaceValue The value of the constant.
- */
- public static String replace(String value, String key, String replaceValue) {
-
- if (value == null || key == null || replaceValue == null) {
- return value;
- }
-
- int pos = value.indexOf(key);
-
- if (pos < 0) {
- return value;
- }
-
- int length = value.length();
- int start = pos;
- int end = pos + key.length();
-
- if (length == key.length()) {
- value = replaceValue;
-
- } else if (end == length) {
- value = value.substring(0, start) + replaceValue;
-
- } else {
- value =
- value.substring(0, start)
- + replaceValue
- + replace(value.substring(end), key, replaceValue);
- }
-
- return value;
- }
-
- /**
- * Convenience method for getting a value from a bean property as a
- * <code>String</code>. If the property is a <code>String[]</code> or
- * <code>Collection</code> and it is empty, an empty <code>String</code>
- * "" is returned. Otherwise, property.toString() is returned. This method
- * may return <code>null</code> if there was an error retrieving the
- * property.
- */
- public static String getValueAsString(Object bean, String property) {
- Object value = null;
-
- try {
- value = PropertyUtils.getProperty(bean, property);
-
- } catch(IllegalAccessException e) {
- log.error(e.getMessage(), e);
- } catch(InvocationTargetException e) {
- log.error(e.getMessage(), e);
- } catch(NoSuchMethodException e) {
- log.error(e.getMessage(), e);
- }
-
- if (value == null) {
- return null;
- }
-
- if (value instanceof String[]) {
- return ((String[]) value).length > 0 ? value.toString() : "";
-
- } else if (value instanceof Collection) {
- return ((Collection) value).isEmpty() ? "" : value.toString();
-
- } else {
- return value.toString();
- }
-
- }
-
- /**
- * Makes a deep copy of a <code>FastHashMap</code> if the values
- * are <code>Msg</code>, <code>Arg</code>,
- * or <code>Var</code>. Otherwise it is a shallow copy.
- *
- * @param map <code>FastHashMap</code> to copy.
- * @return FastHashMap A copy of the <code>FastHashMap</code> that was
- * passed in.
- * @deprecated This method is not part of Validator's public API. Validator
- * will use it internally until FastHashMap references are removed. Use
- * copyMap() instead.
- */
- public static FastHashMap copyFastHashMap(FastHashMap map) {
- FastHashMap results = new FastHashMap();
-
- Iterator i = map.keySet().iterator();
- while (i.hasNext()) {
- String key = (String) i.next();
- Object value = map.get(key);
-
- if (value instanceof Msg) {
- results.put(key, ((Msg) value).clone());
- } else if (value instanceof Arg) {
- results.put(key, ((Arg) value).clone());
- } else if (value instanceof Var) {
- results.put(key, ((Var) value).clone());
- } else {
- results.put(key, value);
- }
- }
-
- results.setFast(true);
- return results;
- }
-
- /**
- * Makes a deep copy of a <code>Map</code> if the values are
- * <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
- * it is a shallow copy.
- *
- * @return A copy of the <code>Map</code> that was passed in.
- */
- public static Map copyMap(Map map) {
- Map results = new HashMap();
-
- Iterator iter = map.keySet().iterator();
- while (iter.hasNext()) {
- String key = (String) iter.next();
- Object value = map.get(key);
-
- if (value instanceof Msg) {
- results.put(key, ((Msg) value).clone());
- } else if (value instanceof Arg) {
- results.put(key, ((Arg) value).clone());
- } else if (value instanceof Var) {
- results.put(key, ((Var) value).clone());
- } else {
- results.put(key, value);
- }
- }
- return results;
- }
-
-}
+/*
+ * $Id$
+ * $Rev$
+ * $Date$
+ *
+ * ====================================================================
+ * Copyright 2001-2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.validator.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.collections.FastHashMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.validator.Arg;
+import org.apache.commons.validator.Msg;
+import org.apache.commons.validator.Var;
+
+/**
+ * Basic utility methods.
+ * <p>
+ * The use of FastHashMap is deprecated and will be replaced in a future
+ * release.
+ * </p>
+ */
+public class ValidatorUtils {
+
+ private static final Log log = LogFactory.getLog(ValidatorUtils.class);
+
+ /**
+ * <p>Replace part of a <code>String</code> with another value.</p>
+ *
+ * @param value <code>String</code> to perform the replacement on.
+ * @param key The name of the constant.
+ * @param replaceValue The value of the constant.
+ *
+ * @return The modified value.
+ */
+ public static String replace(String value, String key, String replaceValue) {
+
+ if (value == null || key == null || replaceValue == null) {
+ return value;
+ }
+
+ int pos = value.indexOf(key);
+
+ if (pos < 0) {
+ return value;
+ }
+
+ int length = value.length();
+ int start = pos;
+ int end = pos + key.length();
+
+ if (length == key.length()) {
+ value = replaceValue;
+
+ } else if (end == length) {
+ value = value.substring(0, start) + replaceValue;
+
+ } else {
+ value =
+ value.substring(0, start)
+ + replaceValue
+ + replace(value.substring(end), key, replaceValue);
+ }
+
+ return value;
+ }
+
+ /**
+ * Convenience method for getting a value from a bean property as a
+ * <code>String</code>. If the property is a <code>String[]</code> or
+ * <code>Collection</code> and it is empty, an empty <code>String</code>
+ * "" is returned. Otherwise, property.toString() is returned. This method
+ * may return <code>null</code> if there was an error retrieving the
+ * property.
+ *
+ * @param bean The bean object.
+ * @param property The name of the property to access.
+ *
+ * @return The value of the property.
+ */
+ public static String getValueAsString(Object bean, String property) {
+ Object value = null;
+
+ try {
+ value = PropertyUtils.getProperty(bean, property);
+
+ } catch(IllegalAccessException e) {
+ log.error(e.getMessage(), e);
+ } catch(InvocationTargetException e) {
+ log.error(e.getMessage(), e);
+ } catch(NoSuchMethodException e) {
+ log.error(e.getMessage(), e);
+ }
+
+ if (value == null) {
+ return null;
+ }
+
+ if (value instanceof String[]) {
+ return ((String[]) value).length > 0 ? value.toString() : "";
+
+ } else if (value instanceof Collection) {
+ return ((Collection) value).isEmpty() ? "" : value.toString();
+
+ } else {
+ return value.toString();
+ }
+
+ }
+
+ /**
+ * Makes a deep copy of a <code>FastHashMap</code> if the values
+ * are <code>Msg</code>, <code>Arg</code>,
+ * or <code>Var</code>. Otherwise it is a shallow copy.
+ *
+ * @param map <code>FastHashMap</code> to copy.
+ * @return FastHashMap A copy of the <code>FastHashMap</code> that was
+ * passed in.
+ * @deprecated This method is not part of Validator's public API. Validator
+ * will use it internally until FastHashMap references are removed. Use
+ * copyMap() instead.
+ */
+ public static FastHashMap copyFastHashMap(FastHashMap map) {
+ FastHashMap results = new FastHashMap();
+
+ Iterator i = map.keySet().iterator();
+ while (i.hasNext()) {
+ String key = (String) i.next();
+ Object value = map.get(key);
+
+ if (value instanceof Msg) {
+ results.put(key, ((Msg) value).clone());
+ } else if (value instanceof Arg) {
+ results.put(key, ((Arg) value).clone());
+ } else if (value instanceof Var) {
+ results.put(key, ((Var) value).clone());
+ } else {
+ results.put(key, value);
+ }
+ }
+
+ results.setFast(true);
+ return results;
+ }
+
+ /**
+ * Makes a deep copy of a <code>Map</code> if the values are
+ * <code>Msg</code>, <code>Arg</code>, or <code>Var</code>. Otherwise,
+ * it is a shallow copy.
+ *
+ * @param map The source Map to copy.
+ *
+ * @return A copy of the <code>Map</code> that was passed in.
+ */
+ public static Map copyMap(Map map) {
+ Map results = new HashMap();
+
+ Iterator iter = map.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ Object value = map.get(key);
+
+ if (value instanceof Msg) {
+ results.put(key, ((Msg) value).clone());
+ } else if (value instanceof Arg) {
+ results.put(key, ((Arg) value).clone());
+ } else if (value instanceof Var) {
+ results.put(key, ((Var) value).clone());
+ } else {
+ results.put(key, value);
+ }
+ }
+ return results;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org