myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r698337 - in /myfaces/extensions/validator/trunk: examples/adapter_demo/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/ examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/ validation...
Date Tue, 23 Sep 2008 20:19:17 GMT
Author: gpetracek
Date: Tue Sep 23 13:19:16 2008
New Revision: 698337

URL: http://svn.apache.org/viewvc?rev=698337&view=rev
Log:
new name for the regex annotation

Added:
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
      - copied, changed from r697737, myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Regex.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java
      - copied, changed from r697737, myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RegexStrategy.java
Removed:
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Regex.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RegexStrategy.java
Modified:
    myfaces/extensions/validator/trunk/examples/adapter_demo/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
    myfaces/extensions/validator/trunk/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java

Modified: myfaces/extensions/validator/trunk/examples/adapter_demo/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/adapter_demo/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java?rev=698337&r1=698336&r2=698337&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/examples/adapter_demo/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
(original)
+++ myfaces/extensions/validator/trunk/examples/adapter_demo/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
Tue Sep 23 13:19:16 2008
@@ -22,7 +22,7 @@
 import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
 import org.apache.myfaces.extensions.validator.crossval.annotation.NotEquals;
 import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
-import org.apache.myfaces.extensions.validator.baseval.annotation.Regex;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
 
 import javax.persistence.Column;
 import javax.persistence.Temporal;
@@ -34,7 +34,7 @@
     @Length(minimum = 2)
     @Column(nullable = false, length = 20)
     @NotEquals("lastName")
-    @Regex("[A-Z][a-z]+")
+    @Pattern("[A-Z][a-z]+")
     private String firstName;
 
     @Length(minimum = 2)

Modified: myfaces/extensions/validator/trunk/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java?rev=698337&r1=698336&r2=698337&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
(original)
+++ myfaces/extensions/validator/trunk/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
Tue Sep 23 13:19:16 2008
@@ -22,7 +22,7 @@
 import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
 import org.apache.myfaces.extensions.validator.crossval.annotation.NotEquals;
 import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
-import org.apache.myfaces.extensions.validator.baseval.annotation.Regex;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
 
 import javax.persistence.Column;
 import javax.persistence.Temporal;
@@ -34,7 +34,7 @@
     @Length(minimum = 2)
     @Column(nullable = false, length = 20)
     @NotEquals("lastName")
-    @Regex("[A-Z][a-z]+")
+    @Pattern("[A-Z][a-z]+")
     private String firstName;
 
     @Length(minimum = 2)

Copied: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
(from r697737, myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Regex.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java?p2=myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java&p1=myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Regex.java&r1=697737&r2=698337&rev=698337&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Regex.java
(original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
Tue Sep 23 13:19:16 2008
@@ -29,7 +29,7 @@
  */
 @Target( { METHOD, FIELD })
 @Retention(RUNTIME)
-public @interface Regex
+public @interface Pattern
 {
     String[] value();
 

Copied: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java
(from r697737, myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RegexStrategy.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java?p2=myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java&p1=myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RegexStrategy.java&r1=697737&r2=698337&rev=698337&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RegexStrategy.java
(original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java
Tue Sep 23 13:19:16 2008
@@ -18,7 +18,7 @@
  */
 package org.apache.myfaces.extensions.validator.baseval.strategy;
 
-import org.apache.myfaces.extensions.validator.baseval.annotation.Regex;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
 import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
 
@@ -27,12 +27,11 @@
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
 import java.lang.annotation.Annotation;
-import java.util.regex.Pattern;
 
 /**
  * @author Gerhard Petracek
  */
-public class RegexStrategy extends AbstractValidationStrategy
+public class PatternStrategy extends AbstractValidationStrategy
 {
 
     protected void processValidation(FacesContext facesContext,
@@ -40,12 +39,12 @@
             Object convertedObject) throws ValidatorException
     {
 
-        Regex annotation = annotationEntry.getAnnotation(Regex.class);
+        Pattern annotation = annotationEntry.getAnnotation(Pattern.class);
 
         for (String expression : annotation.value())
         {
             if (convertedObject == null
-                    || !Pattern.compile(expression).matcher(
+                    || !java.util.regex.Pattern.compile(expression).matcher(
                             convertedObject.toString()).matches())
             {
                 throw new ValidatorException(new FacesMessage(
@@ -59,6 +58,6 @@
 
     protected String getValidationErrorMsgKey(Annotation annotation)
     {
-        return ((Regex) annotation).validationErrorMsgKey();
+        return ((Pattern) annotation).validationErrorMsgKey();
     }
 }
\ No newline at end of file



Mime
View raw message