You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2007/03/26 07:24:14 UTC

svn commit: r522423 - /incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/validation/validator/EmailAddressPatternValidator.java

Author: ivaynberg
Date: Sun Mar 25 22:24:14 2007
New Revision: 522423

URL: http://svn.apache.org/viewvc?view=rev&rev=522423
Log:
api clarifications

Added:
    incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/validation/validator/EmailAddressPatternValidator.java

Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/validation/validator/EmailAddressPatternValidator.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/validation/validator/EmailAddressPatternValidator.java?view=auto&rev=522423
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/validation/validator/EmailAddressPatternValidator.java (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/validation/validator/EmailAddressPatternValidator.java Sun Mar 25 22:24:14 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 wicket.validation.validator;
+
+import java.util.regex.Pattern;
+
+/**
+ * Validator for checking the form/pattern of email addresses.
+ * 
+ * @deprecated see {@link EmailAddressValidator}
+ * 
+ * @author Chris Turner
+ * @author Jonathan Locke
+ * @author Martijn Dashorst
+ */
+public class EmailAddressPatternValidator extends PatternValidator
+{
+	private static final long serialVersionUID = 1L;
+
+	/** Singleton instance */
+	private static final EmailAddressPatternValidator INSTANCE = new EmailAddressPatternValidator();
+
+	/**
+	 * @return Instance of emailadress validator
+	 */
+	public static EmailAddressPatternValidator getInstance()
+	{
+		return INSTANCE;
+	}
+
+	/**
+	 * Protected constructor to force use of static singleton accessor method.
+	 * Or override it to implement resourceKey(Component)
+	 */
+	protected EmailAddressPatternValidator()
+	{
+		super(
+				"^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z]{2,}){1}$)",
+				Pattern.CASE_INSENSITIVE);
+	}
+
+	protected String resourceKey()
+	{
+		return "EmailAddressPatternValidator";
+	}
+}