You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2004/04/11 08:47:22 UTC
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator GenericValidator.java Form.java
dgraham 2004/04/10 23:47:22
Modified: validator/src/share/org/apache/commons/validator
GenericValidator.java Form.java
Log:
Detabbed file.
Revision Changes Path
1.31 +45 -45 jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java
Index: GenericValidator.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- GenericValidator.java 8 Apr 2004 22:51:17 -0000 1.30
+++ GenericValidator.java 11 Apr 2004 06:47:22 -0000 1.31
@@ -40,11 +40,11 @@
* CreditCardValidator used in wrapper method.
*/
private static final CreditCardValidator creditCardValidator =
- new CreditCardValidator();
+ new CreditCardValidator();
/**
- * <p>Checks if the field isn't null and length of the field is greater than zero not
- * including whitespace.</p>
+ * <p>Checks if the field isn't null and length of the field is greater
+ * than zero not including whitespace.</p>
*
* @param value The value validation is being performed on.
*/
@@ -70,7 +70,7 @@
/**
* <p>Checks if the value can safely be converted to a byte primitive.</p>
*
- * @param value The value validation is being performed on.
+ * @param value The value validation is being performed on.
*/
public static boolean isByte(String value) {
return (GenericTypeValidator.formatByte(value) != null);
@@ -79,7 +79,7 @@
/**
* <p>Checks if the value can safely be converted to a short primitive.</p>
*
- * @param value The value validation is being performed on.
+ * @param value The value validation is being performed on.
*/
public static boolean isShort(String value) {
return (GenericTypeValidator.formatShort(value) != null);
@@ -88,7 +88,7 @@
/**
* <p>Checks if the value can safely be converted to a int primitive.</p>
*
- * @param value The value validation is being performed on.
+ * @param value The value validation is being performed on.
*/
public static boolean isInt(String value) {
return (GenericTypeValidator.formatInt(value) != null);
@@ -127,7 +127,7 @@
* is set to <code>false</code> for all.</p>
*
* @param value The value validation is being performed on.
- * @param locale The locale to use for the date format, defaults to the default
+ * @param locale The locale to use for the date format, defaults to the
* system default if null.
*/
public static boolean isDate(String value, Locale locale) {
@@ -150,24 +150,24 @@
}
/**
- * <p>Checks if a value is within a range (min & max specified
- * in the vars attribute).</p>
- *
- * @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.
- */
- public static boolean isInRange(byte value, byte min, byte max) {
- return ((value >= min) && (value <= max));
- }
+ * <p>Checks if a value is within a range (min & max specified
+ * in the vars attribute).</p>
+ *
+ * @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.
+ */
+ public static boolean isInRange(byte value, byte min, byte max) {
+ return ((value >= min) && (value <= max));
+ }
/**
* <p>Checks if a value is within a range (min & max specified
* in the vars attribute).</p>
*
- * @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.
+ * @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.
*/
public static boolean isInRange(int value, int min, int max) {
return ((value >= min) && (value <= max));
@@ -177,9 +177,9 @@
* <p>Checks if a value is within a range (min & max specified
* in the vars attribute).</p>
*
- * @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.
+ * @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.
*/
public static boolean isInRange(float value, float min, float max) {
return ((value >= min) && (value <= max));
@@ -189,33 +189,33 @@
* <p>Checks if a value is within a range (min & max specified
* in the vars attribute).</p>
*
- * @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.
+ * @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.
*/
public static boolean isInRange(short value, short min, short max) {
return ((value >= min) && (value <= max));
}
- /**
- * <p>Checks if a value is within a range (min & max specified
- * in the vars attribute).</p>
- *
- * @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.
- */
- public static boolean isInRange(long value, long min, long max) {
- return ((value >= min) && (value <= max));
- }
+ /**
+ * <p>Checks if a value is within a range (min & max specified
+ * in the vars attribute).</p>
+ *
+ * @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.
+ */
+ public static boolean isInRange(long value, long min, long max) {
+ return ((value >= min) && (value <= max));
+ }
/**
* <p>Checks if a value is within a range (min & max specified
* in the vars attribute).</p>
*
- * @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.
+ * @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.
*/
public static boolean isInRange(double value, double min, double max) {
return ((value >= min) && (value <= max));
@@ -262,8 +262,8 @@
/**
* <p>Checks if the value's length is greater than or equal to the min.</p>
*
- * @param value The value validation is being performed on.
- * @param min The minimum length.
+ * @param value The value validation is being performed on.
+ * @param min The minimum length.
*/
public static boolean minLength(String value, int min) {
return (value.length() >= min);
1.18 +82 -82 jakarta-commons/validator/src/share/org/apache/commons/validator/Form.java
Index: Form.java
===================================================================
RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Form.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Form.java 8 Apr 2004 23:22:03 -0000 1.17
+++ Form.java 11 Apr 2004 06:47:22 -0000 1.18
@@ -32,9 +32,9 @@
/**
* <p>
- * This contains a set of validation rules for a form/JavaBean. The information is
- * contained in a list of <code>Field</code> objects. Instances of this class are
- * configured with a <form> xml element.
+ * This contains a set of validation rules for a form/JavaBean. The information
+ * is contained in a list of <code>Field</code> objects. Instances of this
+ * class are configured with a <form> xml element.
* </p>
*/
public class Form implements Serializable {
@@ -58,17 +58,17 @@
*/
protected FastHashMap hFields = new FastHashMap();
- /**
- * The name/key of the form which this form extends from.
+ /**
+ * The name/key of the form which this form extends from.
* @since Validator 1.2.0
- */
- protected String inherit = null;
+ */
+ protected String inherit = null;
- /**
- * Whether or not the this <code>Form</code> was processed
- * for replacing variables in strings with their values.
- */
- private boolean processed = false;
+ /**
+ * Whether or not the this <code>Form</code> was processed
+ * for replacing variables in strings with their values.
+ */
+ private boolean processed = false;
/**
* Gets the name/key of the set of validation rules.
@@ -117,43 +117,43 @@
return this.hFields.containsKey(fieldName);
}
- /**
- * Processes all of the <code>Form</code>'s <code>Field</code>s.
+ /**
+ * Processes all of the <code>Form</code>'s <code>Field</code>s.
* @since Validator 1.2.0
- */
- protected void process(Map globalConstants, Map constants, Map forms) {
- if (isProcessed()) {
- return;
- }
-
- int n = 0; //we want the fields from its parent first
- if (isExtending()) {
- Form parent = (Form) forms.get(inherit);
- if (parent != null) {
- if (!parent.isProcessed()) {
- //we want to go all the way up the tree
- parent.process(constants, globalConstants, forms);
- }
- for (Iterator i = parent.getFields().iterator(); i.hasNext();) {
- Field f = (Field) i.next();
- //we want to be able to override any fields we like
- if (hFields.get(f.getKey()) == null) {
- lFields.add(n, f);
- hFields.put(f.getKey(), f);
- n++;
- }
- }
- }
- }
- hFields.setFast(true);
- //no need to reprocess parent's fields, we iterate from 'n'
- for (Iterator i = lFields.listIterator(n); i.hasNext();) {
- Field f = (Field) i.next();
- f.process(globalConstants, constants);
- }
+ */
+ protected void process(Map globalConstants, Map constants, Map forms) {
+ if (isProcessed()) {
+ return;
+ }
+
+ int n = 0; //we want the fields from its parent first
+ if (isExtending()) {
+ Form parent = (Form) forms.get(inherit);
+ if (parent != null) {
+ if (!parent.isProcessed()) {
+ //we want to go all the way up the tree
+ parent.process(constants, globalConstants, forms);
+ }
+ for (Iterator i = parent.getFields().iterator(); i.hasNext();) {
+ Field f = (Field) i.next();
+ //we want to be able to override any fields we like
+ if (hFields.get(f.getKey()) == null) {
+ lFields.add(n, f);
+ hFields.put(f.getKey(), f);
+ n++;
+ }
+ }
+ }
+ }
+ hFields.setFast(true);
+ //no need to reprocess parent's fields, we iterate from 'n'
+ for (Iterator i = lFields.listIterator(n); i.hasNext();) {
+ Field f = (Field) i.next();
+ f.process(globalConstants, constants);
+ }
- processed = true;
- }
+ processed = true;
+ }
/**
* Returns a string representation of the object.
@@ -202,36 +202,36 @@
return results;
}
- /**
- * Whether or not the this <code>Form</code> was processed
- * for replacing variables in strings with their values.
- * @since Validator 1.2.0
- */
- public boolean isProcessed() {
- return processed;
- }
-
- /**
- * Gets the name/key of the parent set of validation rules.
- * @since Validator 1.2.0
- */
- public String getExtends() {
- return inherit;
- }
-
- /**
- * Sets the name/key of the parent set of validation rules.
- * @since Validator 1.2.0
- */
- public void setExtends(String string) {
- inherit = string;
- }
-
- /**
- * Get extends flag.
- * @since Validator 1.2.0
- */
- public boolean isExtending() {
- return inherit != null;
- }
+ /**
+ * Whether or not the this <code>Form</code> was processed
+ * for replacing variables in strings with their values.
+ * @since Validator 1.2.0
+ */
+ public boolean isProcessed() {
+ return processed;
+ }
+
+ /**
+ * Gets the name/key of the parent set of validation rules.
+ * @since Validator 1.2.0
+ */
+ public String getExtends() {
+ return inherit;
+ }
+
+ /**
+ * Sets the name/key of the parent set of validation rules.
+ * @since Validator 1.2.0
+ */
+ public void setExtends(String string) {
+ inherit = string;
+ }
+
+ /**
+ * Get extends flag.
+ * @since Validator 1.2.0
+ */
+ public boolean isExtending() {
+ return inherit != null;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org