You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rl...@apache.org on 2003/04/30 23:51:05 UTC
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator Arg.java Constant.java UrlValidator.java Validator.java
rleland 2003/04/30 14:51:05
Modified: validator/src/share/org/apache/commons/validator Arg.java
Constant.java UrlValidator.java Validator.java
Log:
No functional changes. Cleanup JavaDoc for some of the public methods.
Revision Changes Path
1.6 +36 -28 jakarta-commons/validator/src/share/org/apache/commons/validator/Arg.java
Index: Arg.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Arg.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Arg.java 16 Mar 2003 00:23:15 -0000 1.5
+++ Arg.java 30 Apr 2003 21:51:05 -0000 1.6
@@ -66,14 +66,14 @@
/**
- * <p>A default argument or an argument for a
- * specific validator definition (ex: required)
- * can be stored to pass into a message as parameters. This can be used in a
- * pluggable validator for constructing locale
- * sensitive messages by using <code>java.text.MessageFormat</code>
- * or an equivalent class. The resource field can be
- * used to determine if the value stored in the argument
- * is a value to be retrieved from a locale sensitive
+ * <p>A default argument or an argument for a
+ * specific validator definition (ex: required)
+ * can be stored to pass into a message as parameters. This can be used in a
+ * pluggable validator for constructing locale
+ * sensitive messages by using <code>java.text.MessageFormat</code>
+ * or an equivalent class. The resource field can be
+ * used to determine if the value stored in the argument
+ * is a value to be retrieved from a locale sensitive
* message retrieval system like <code>java.util.PropertyResourceBundle</code>.
* The resource field defaults to 'true'.</p>
*
@@ -93,7 +93,7 @@
protected String key = null;
/**
- * Whether or not the key is a message resource (optional). Defaults to true.
+ * Whether or not the key is a message resource (optional). Defaults to true.
* If it is 'true', the value will try to be resolved as a message resource.
*/
protected boolean resource = true;
@@ -101,48 +101,55 @@
/**
* Gets the name of the dependency.
+ * @return the name of the dependency.
*/
public String getName() {
- return name;
+ return name;
}
/**
* Sets the name of the dependency.
+ * @param name the name of the dependency.
*/
public void setName(String name) {
- this.name = name;
+ this.name = name;
}
-
+
/**
* Gets the key/value.
+ * @return the key value.
*/
public String getKey() {
- return key;
+ return key;
}
/**
* Sets the key/value.
+ * @param key They to access the argument.
*/
public void setKey(String key) {
- this.key = key;
+ this.key = key;
}
-
+
/**
* Gets whether or not the key is a resource.
+ * @return Returns true if key is a resource.
*/
public boolean getResource() {
- return resource;
+ return resource;
}
/**
* Sets whether or not the key is a resource.
+ * @param resource If true indicates the key is a resource.
*/
public void setResource(boolean resource) {
- this.resource = resource;
+ this.resource = resource;
}
/**
* Creates and returns a copy of this object.
+ * @return A copy of this object.
*/
public Object clone() {
try {
@@ -151,25 +158,26 @@
if (name != null) {
arg.setName(new String(name));
}
-
+
if (key != null) {
arg.setKey(new String(key));
}
-
+
arg.setResource(resource);
return arg;
} catch (CloneNotSupportedException e) {
throw new InternalError(e.toString());
}
- }
-
+ }
+
/**
* Returns a string representation of the object.
+ * @return a string representation of the object.
*/
public String toString() {
StringBuffer results = new StringBuffer();
-
+
results.append("Arg: name=");
results.append(name);
results.append(" key=");
@@ -177,8 +185,8 @@
results.append(" resource=");
results.append(resource);
results.append("\n");
-
+
return results.toString();
}
-
+
}
1.4 +22 -17 jakarta-commons/validator/src/share/org/apache/commons/validator/Constant.java
Index: Constant.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Constant.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Constant.java 30 Mar 2002 04:33:17 -0000 1.3
+++ Constant.java 30 Apr 2003 21:51:05 -0000 1.4
@@ -66,11 +66,11 @@
/**
- * <p>A constant can be used to define a global or
- * locale level constant that can be used to replace
- * values in certain fields. The <code>Field</code>'s
- * property field, the <code>Var</code>'s value field,
- * the <code>Msg</code>'s key field, and the <code>Arg</code>'s
+ * <p>A constant can be used to define a global or
+ * locale level constant that can be used to replace
+ * values in certain fields. The <code>Field</code>'s
+ * property field, the <code>Var</code>'s value field,
+ * the <code>Msg</code>'s key field, and the <code>Arg</code>'s
* key field can all contain constants reference for replacement.
* <br>
* ex: <constant name="zip" value="^\d{5}$" /><br>
@@ -93,45 +93,50 @@
/**
* Gets the name of the constant.
+ * @return the name o fthe constant.
*/
public String getName() {
- return name;
+ return name;
}
/**
* Sets the name of the constant.
+ * @param name sets the name of the constant.
*/
public void setName(String name) {
- this.name = name;
+ this.name = name;
}
/**
* Gets the value of the constant.
+ * @return the value of the constant.
*/
public String getValue() {
- return value;
+ return value;
}
/**
* Sets the value of the constant.
+ * @param value the value of the constant.
*/
public void setValue(String value) {
- this.value = value;
+ this.value = value;
}
/**
* Returns a string representation of the object.
- */
+ * @return the string representation of the object.
+ */
public String toString() {
StringBuffer results = new StringBuffer();
-
+
results.append("Constant: name=");
results.append(name);
results.append(" value=");
results.append(value);
results.append("\n");
-
+
return results.toString();
}
-
+
}
1.3 +17 -7 jakarta-commons/validator/src/share/org/apache/commons/validator/UrlValidator.java
Index: UrlValidator.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/UrlValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UrlValidator.java 30 Apr 2003 20:31:45 -0000 1.2
+++ UrlValidator.java 30 Apr 2003 21:51:05 -0000 1.3
@@ -120,21 +120,30 @@
/**
* Allow a double slash in the path componet such that
- * path//file is treated as path/file
+ * path//file is treated as path/file.
*/
public static final String OPTION_ALLOW_2_SLASH = "allow2Slash";
+ /**
+ * Don't allow a fragment in a url. A fragment is usually indicated
+ * by a '#' character and follows a query.
+ */
public static final String OPTION_NO_FRAGMENT = "noFragment";
// Non static fields
private boolean allow2Slash = false;
private boolean noFragment = false;
+ /**
+ * Construct a UrlValidator with default behaviour.
+ */
public UrlValidator() {
}
/**
* Behavour of validation is modified by passing in several strings options:
+ * @param options Pass in one or more of the OPTION_XXXX predefined strings
+ * to change the validation behavour.
* allow2Slash - Allows double '/' characters in the path component
* noFragment - If the noFragment option is included then fragments are flagged as illegal.
**/
@@ -155,8 +164,8 @@
/**
* Behavour of validation is modified by passing in options:
- * allow2Slash - If True, allows double '/' characters in the path component
- * noFragment - If true, fragments are flagged as illegal.
+ * @param allow2Slash If True, allows double '/' characters in the path component
+ * @param noFragment If true, fragments are flagged as illegal.
**/
public UrlValidator(boolean allow2Slash, boolean noFragment) {
@@ -170,6 +179,7 @@
* <p>Checks if a field has a valid url address.</p>
*
* @param value The value validation is being performed on.
+ * @return true if the url is valid.
*/
public boolean isValid(String value) {
boolean bValid = true;
1.16 +9 -9 jakarta-commons/validator/src/share/org/apache/commons/validator/Validator.java
Index: Validator.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Validator.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Validator.java 17 Mar 2003 01:41:17 -0000 1.15
+++ Validator.java 30 Apr 2003 21:51:05 -0000 1.16
@@ -123,7 +123,7 @@
* specified in the method signature.
*/
public static String VALIDATOR_KEY = "org.apache.commons.validator.Validator";
-
+
/**
* Resources key the <code>Locale</code> is stored.
* This will be used to retrieve the appropriate
@@ -279,7 +279,7 @@
* using Context ClassLoader, then the class-loading defaults to
* using the calling-class' ClassLoader.
*
- * @param boolean determines whether to use Context ClassLoader.
+ * @param use determines whether to use Context ClassLoader.
*/
public void setUseContextClassLoader(boolean use) {
@@ -359,7 +359,7 @@
+ field.getProperty());
return false;
}
-
+
if (!validateFieldForRule(field, action, results, actions, pos)) {
return false;
}
@@ -516,7 +516,7 @@
+ field.getProperty());
return;
}
-
+
boolean good =
validateFieldForRule(field, action, results, actions, pos);
allResults.merge(results);
@@ -540,7 +540,7 @@
+ field.getProperty());
return;
}
-
+
boolean good = validateFieldForRule(field, action, results, actions, 0);
allResults.merge(results);
if (!good) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org