You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2012/06/16 10:12:10 UTC

[9/11] git commit: done javadoc TODO

done javadoc TODO


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fefecbfa
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fefecbfa
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fefecbfa

Branch: refs/heads/master
Commit: fefecbfa0dd8beda666e971b55acf2de941f0106
Parents: b8082ca
Author: svenmeier <sv...@apache.org>
Authored: Fri Jun 15 16:47:15 2012 +0200
Committer: svenmeier <sv...@apache.org>
Committed: Fri Jun 15 22:22:24 2012 +0200

----------------------------------------------------------------------
 .../validation/validator/PatternValidator.java     |   48 ++++++---------
 1 files changed, 18 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/fefecbfa/wicket-core/src/main/java/org/apache/wicket/validation/validator/PatternValidator.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/validation/validator/PatternValidator.java b/wicket-core/src/main/java/org/apache/wicket/validation/validator/PatternValidator.java
index 56e2446..c093317 100644
--- a/wicket-core/src/main/java/org/apache/wicket/validation/validator/PatternValidator.java
+++ b/wicket-core/src/main/java/org/apache/wicket/validation/validator/PatternValidator.java
@@ -18,53 +18,42 @@ package org.apache.wicket.validation.validator;
 
 import java.util.regex.Pattern;
 
+import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.util.parse.metapattern.MetaPattern;
 import org.apache.wicket.validation.IValidatable;
+import org.apache.wicket.validation.IValidationError;
 import org.apache.wicket.validation.IValidator;
 import org.apache.wicket.validation.ValidationError;
 
-// FIXME 2.0: ivaynberg: look over javadoc
 /**
- * Validates a <code>Component</code> by matching the component's value against a regular expression
- * pattern. A <code>PatternValidator</code> can be constructed with either a Java regular expression
- * (compiled or not) or a <code>MetaPattern</code>. If the pattern matches against the value of the
- * <code>Component</code> it is attached to when <code>validate</code> is called by the framework,
- * then that input value is considered valid. If the pattern does not match, the
- * <code>errorMessage</code> method will be called.
+ * Validates an {@link IValidatable} by matching the value against a regular expression pattern. A
+ * <code>PatternValidator</code> can be constructed with either a Java regular expression (compiled
+ * or not) or a {@link MetaPattern}. If the pattern matches against the value then it is considered
+ * valid. If the pattern does not match, the an {@link IValidationError} will be reported on the
+ * {@link IValidatable}.
  * <p>
  * For example, to restrict a field to only digits, you might add a <code>PatternValidator</code>
  * constructed with the pattern "\d+". Another way to do the same thing would be to construct the
- * <code>PatternValidator</code> passing in <code>MetaPattern.DIGITS</code>. The advantages of using
- * <code>MetaPattern</code> over straight Java regular expressions are that the patterns are easier
- * to construct and easier to combine into complex patterns. They are also more readable and more
- * reusable. See {@link org.apache.wicket.util.parse.metapattern.MetaPattern MetaPattern} for
- * details.
+ * <code>PatternValidator</code> passing in {@link MetaPattern#DIGITS}. The advantages of using
+ * {@link MetaPattern} over straight Java regular expressions are that the patterns are easier to
+ * construct and easier to combine into complex patterns. They are also more readable and more
+ * reusable. See {@link MetaPattern} for details.
  * <p>
- * The error message will be generated with the key "PatternValidator" and the message keys that can
- * be used are:
- * <p>
- * <ul>
- * <li>${pattern}: the pattern which failed to match</li>
- * <li>${input}: the input the user gave</li>
- * <li>${name}: the name of the <code>Component</code> that failed</li>
- * <li>${label}: the label of the <code>Component</code> - either comes from
- * <code>FormComponent.labelModel</code> or resource key [form-id].[form-component-id] in that order
- * </li>
- * </ul>
+ * The error message will be generated with the key "PatternValidator" and one additional message
+ * key ${pattern} for the pattern which failed to match. See {@link FormComponent} for a list of
+ * further messages keys.
  * 
  * @see java.util.regex.Pattern
- * @see org.apache.wicket.util.parse.metapattern.MetaPattern
  * 
  * @author Jonathan Locke
  * @author Igor Vaynberg (ivaynberg)
- * 
  * @since 1.2.6
  */
 public class PatternValidator implements IValidator<String>
 {
 	private static final long serialVersionUID = 1L;
 
-	/** the <code>java.util.regex.Pattern</code> */
+	/** the pattern to match */
 	private final Pattern pattern;
 
 	/** whether to exclude matching input **/
@@ -96,10 +85,10 @@ public class PatternValidator implements IValidator<String>
 	}
 
 	/**
-	 * Constructor that accepts a Java <code>regex</code> <code>Pattern</code> argument.
+	 * Constructor that accepts a compiled pattern.
 	 * 
 	 * @param pattern
-	 *            a Java <code>regex</code> <code>Pattern</code>
+	 *            a compiled pattern
 	 */
 	public PatternValidator(final Pattern pattern)
 	{
@@ -177,5 +166,4 @@ public class PatternValidator implements IValidator<String>
 	{
 		return error;
 	}
-
-}
+}
\ No newline at end of file