bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject [06/15] bval git commit: updates to default constraint validators
Date Wed, 15 Nov 2017 22:54:11 GMT
updates to default constraint validators


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

Branch: refs/heads/bv2
Commit: 8f19bcb50411af364302aee6196c95636fc30232
Parents: b21b35a
Author: Matt Benson <mbenson@apache.org>
Authored: Wed Nov 15 15:52:48 2017 -0600
Committer: Matt Benson <mbenson@apache.org>
Committed: Wed Nov 15 16:53:43 2017 -0600

----------------------------------------------------------------------
 .../bval/constraints/AssertFalseValidator.java  |  6 +----
 .../bval/constraints/AssertTrueValidator.java   |  6 +----
 .../DecimalMaxValidatorForNumber.java           | 12 +++++-----
 .../DecimalMaxValidatorForString.java           |  2 +-
 .../DecimalMinValidatorForNumber.java           | 12 +++++-----
 .../DecimalMinValidatorForString.java           |  2 +-
 .../java/org/apache/bval/constraints/Email.java | 15 ++++++++-----
 .../apache/bval/constraints/EmailValidator.java |  6 +----
 .../bval/constraints/MaxValidatorForNumber.java |  4 ++--
 .../bval/constraints/MaxValidatorForString.java |  2 +-
 .../bval/constraints/MinValidatorForNumber.java |  4 ++--
 .../bval/constraints/MinValidatorForString.java |  2 +-
 .../org/apache/bval/constraints/NotEmpty.java   | 23 ++++++++++++++------
 .../bval/constraints/NotEmptyValidator.java     | 19 +++++-----------
 .../NotEmptyValidatorForCollection.java         |  7 ++----
 .../constraints/NotEmptyValidatorForMap.java    |  6 +----
 .../constraints/NotEmptyValidatorForString.java |  6 +----
 .../bval/constraints/NotNullValidator.java      |  4 ----
 .../apache/bval/constraints/NullValidator.java  |  5 -----
 .../bval/constraints/PatternValidator.java      |  4 ++--
 20 files changed, 63 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/AssertFalseValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/AssertFalseValidator.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/AssertFalseValidator.java
index 9eb4a14..143b76a 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/AssertFalseValidator.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/AssertFalseValidator.java
@@ -28,12 +28,8 @@ import javax.validation.constraints.AssertFalse;
 public class AssertFalseValidator implements ConstraintValidator<AssertFalse, Boolean>
{
 
     @Override
-    public void initialize(AssertFalse annotation) {
-    }
-
-    @Override
     public boolean isValid(Boolean value, ConstraintValidatorContext context) {
-        return value == null || Boolean.FALSE.equals(value);
+        return !Boolean.TRUE.equals(value);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/AssertTrueValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/AssertTrueValidator.java b/bval-jsr/src/main/java/org/apache/bval/constraints/AssertTrueValidator.java
index 47ee7f6..93ae933 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/AssertTrueValidator.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/AssertTrueValidator.java
@@ -28,12 +28,8 @@ import javax.validation.constraints.AssertTrue;
 public class AssertTrueValidator implements ConstraintValidator<AssertTrue, Boolean>
{
 
     @Override
-    public void initialize(AssertTrue annotation) {
-    }
-
-    @Override
     public boolean isValid(Boolean value, ConstraintValidatorContext context) {
-        return value == null || Boolean.TRUE.equals(value);
+        return !Boolean.FALSE.equals(value);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java
index dd0c210..725613c 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForNumber.java
@@ -43,12 +43,14 @@ public class DecimalMaxValidatorForNumber implements ConstraintValidator<Decimal
         if (value == null) {
             return true;
         }
+        BigDecimal bigValue;
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(maxValue) != 1;
+            bigValue = (BigDecimal) value;
+        } else if (value instanceof BigInteger) {
+            bigValue = new BigDecimal((BigInteger) value);
+        } else {
+            bigValue = new BigDecimal(value.doubleValue());
         }
-        if (value instanceof BigInteger) {
-            return (new BigDecimal((BigInteger) value)).compareTo(maxValue) != 1;
-        }
-        return (new BigDecimal(value.doubleValue()).compareTo(maxValue)) != 1;
+        return bigValue.compareTo(maxValue) < 1;
     }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java
index a247297..cb0e232 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMaxValidatorForString.java
@@ -46,7 +46,7 @@ public class DecimalMaxValidatorForString implements ConstraintValidator<Decimal
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(maxValue) != 1;
+            return new BigDecimal(value).compareTo(maxValue) < 1;
         } catch (NumberFormatException nfe) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java
index 74ed17a..17c6c38 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForNumber.java
@@ -43,12 +43,14 @@ public class DecimalMinValidatorForNumber implements ConstraintValidator<Decimal
         if (value == null) {
             return true;
         }
+        BigDecimal bigValue;
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(minValue) != -1;
+            bigValue = (BigDecimal) value;
+        } else if (value instanceof BigInteger) {
+            bigValue = new BigDecimal((BigInteger) value);
+        } else {
+            bigValue = new BigDecimal(value.doubleValue());
         }
-        if (value instanceof BigInteger) {
-            return (new BigDecimal((BigInteger) value)).compareTo(minValue) != -1;
-        }
-        return (new BigDecimal(value.doubleValue()).compareTo(minValue)) != -1;
+        return bigValue.compareTo(minValue) >= 0;
     }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java
index 8110f8e..ef62387 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/DecimalMinValidatorForString.java
@@ -48,7 +48,7 @@ public class DecimalMinValidatorForString implements ConstraintValidator<Decimal
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(minValue) != -1;
+            return new BigDecimal(value).compareTo(minValue) >= 0;
         } catch (NumberFormatException nfe) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java b/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java
index 2d66d28..b7c9698 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/Email.java
@@ -18,35 +18,40 @@
  */
 package org.apache.bval.constraints;
 
-import javax.validation.Constraint;
+import javax.validation.OverridesAttribute;
 import javax.validation.Payload;
 import java.lang.annotation.Documented;
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE_USE;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
 /**
  * <p>
  * --
- * TODO - This class is NOT part of the bean_validation spec and might disappear
- * as soon as a final version of the specification contains a similar functionality.
+ * NOTE - This constraint predates the equivalent version from the bean_validation spec.
  * --
  * </p>
  * Description: annotation to validate an email address (by pattern)<br/>
  */
+@Deprecated
 @Documented
-@Constraint(validatedBy = EmailValidator.class)
-@Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER })
+@javax.validation.constraints.Email
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
 @Retention(RUNTIME)
 public @interface Email {
+    @OverridesAttribute(constraint = javax.validation.constraints.Email.class, name = "groups")
     Class<?>[] groups() default {};
 
+    @OverridesAttribute(constraint = javax.validation.constraints.Email.class, name = "message")
     String message() default "{org.apache.bval.constraints.Email.message}";
 
+    @OverridesAttribute(constraint = javax.validation.constraints.Email.class, name = "payload")
     Class<? extends Payload>[] payload() default {};
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java b/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java
index bcdf0fe..cb6f748 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/EmailValidator.java
@@ -26,15 +26,11 @@ import javax.validation.ConstraintValidatorContext;
 /**
  * Description: <br/>
  */
-public class EmailValidator implements ConstraintValidator<Email, CharSequence> {
+public class EmailValidator implements ConstraintValidator<javax.validation.constraints.Email,
CharSequence> {
 
     @Override
     public boolean isValid(CharSequence value, ConstraintValidatorContext context) {
         return EMailValidationUtils.isValid(value);
     }
 
-    @Override
-    public void initialize(Email parameters) {
-        // do nothing (as long as Email has no properties)
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java
index 78524f9..0ad81a8 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForNumber.java
@@ -43,10 +43,10 @@ public class MaxValidatorForNumber implements ConstraintValidator<Max,
Number> {
             return true;
         }
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(max)) != 1;
+            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(max)) < 1;
         }
         if (value instanceof BigInteger) {
-            return ((BigInteger) value).compareTo(BigInteger.valueOf(max)) != 1;
+            return ((BigInteger) value).compareTo(BigInteger.valueOf(max)) < 1;
         }
         return value.longValue() <= max;
     }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java
index 4170a5c..f14f8e7 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/MaxValidatorForString.java
@@ -42,7 +42,7 @@ public class MaxValidatorForString implements ConstraintValidator<Max,
String> {
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(BigDecimal.valueOf(max)) != 1;
+            return new BigDecimal(value).compareTo(BigDecimal.valueOf(max)) < 1;
         } catch (NumberFormatException nfe) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java
index b5aeaad..c467de2 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForNumber.java
@@ -42,10 +42,10 @@ public class MinValidatorForNumber implements ConstraintValidator<Min,
Number> {
             return true;
         }
         if (value instanceof BigDecimal) {
-            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(minValue)) != -1;
+            return ((BigDecimal) value).compareTo(BigDecimal.valueOf(minValue)) >= 0;
         }
         if (value instanceof BigInteger) {
-            return ((BigInteger) value).compareTo(BigInteger.valueOf(minValue)) != -1;
+            return ((BigInteger) value).compareTo(BigInteger.valueOf(minValue)) >= 0;
         }
         return value.longValue() >= minValue;
     }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
index bd3a4dd..5d45fc2 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
@@ -42,7 +42,7 @@ public class MinValidatorForString implements ConstraintValidator<Min,
String> {
             return true;
         }
         try {
-            return new BigDecimal(value).compareTo(BigDecimal.valueOf(minValue)) != -1;
+            return new BigDecimal(value).compareTo(BigDecimal.valueOf(minValue)) >= 0;
         } catch (NumberFormatException nfe) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java
index ffa8cf8..9d5fd3a 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmpty.java
@@ -18,18 +18,22 @@
  */
 package org.apache.bval.constraints;
 
-import javax.validation.Constraint;
-import javax.validation.Payload;
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE_USE;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.OverridesAttribute;
+import javax.validation.Payload;
+
 /**
  * <pre>
  * This class is NOT part of the bean_validation spec and might disappear
@@ -39,12 +43,17 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
 @Documented
 @Constraint(validatedBy = { NotEmptyValidatorForCollection.class, NotEmptyValidatorForMap.class,
     NotEmptyValidatorForString.class, NotEmptyValidator.class })
-@Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
 @Retention(RUNTIME)
+@javax.validation.constraints.NotEmpty
+@Deprecated
 public @interface NotEmpty {
+    @OverridesAttribute(constraint = javax.validation.constraints.NotEmpty.class, name =
"groups")
     Class<?>[] groups() default {};
 
+    @OverridesAttribute(constraint = javax.validation.constraints.NotEmpty.class, name =
"message")
     String message() default "{org.apache.bval.constraints.NotEmpty.message}";
 
+    @OverridesAttribute(constraint = javax.validation.constraints.NotEmpty.class, name =
"payload")
     Class<? extends Payload>[] payload() default {};
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
index 4316b39..92c8739 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
@@ -25,14 +25,10 @@ import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 /**
- * Description:  Check the non emptyness of an
+ * Description:  Check the non emptiness of an
  * any object that has a public isEmpty():boolean or a valid toString() method
  */
-public class NotEmptyValidator implements ConstraintValidator<NotEmpty, Object> {
-    @Override
-    public void initialize(NotEmpty constraintAnnotation) {
-        // do nothing
-    }
+public class NotEmptyValidator implements ConstraintValidator<javax.validation.constraints.NotEmpty,
Object> {
 
     @Override
     public boolean isValid(Object value, ConstraintValidatorContext context) {
@@ -45,15 +41,12 @@ public class NotEmptyValidator implements ConstraintValidator<NotEmpty,
Object>
         try {
             final Method isEmptyMethod = value.getClass().getMethod("isEmpty");
             if (isEmptyMethod != null) {
-                return !((Boolean) isEmptyMethod.invoke(value)).booleanValue();
+                return !Boolean.TRUE.equals(isEmptyMethod.invoke(value));
             }
-        } catch (IllegalAccessException iae) {
-            // do nothing
-        } catch (NoSuchMethodException nsme) {
-            // do nothing
-        } catch (InvocationTargetException ite) {
+        } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException
iae) {
             // do nothing
         }
-        return !value.toString().isEmpty();
+        final String s = value.toString();
+        return s != null && !s.isEmpty();
     }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
index 5faab13..da0c438 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
@@ -25,11 +25,8 @@ import java.util.Collection;
 /**
  * Description: <br/>
  */
-public class NotEmptyValidatorForCollection implements ConstraintValidator<NotEmpty, Collection<?>>
{
-    @Override
-    public void initialize(NotEmpty constraintAnnotation) {
-        // do nothing
-    }
+public class NotEmptyValidatorForCollection
+    implements ConstraintValidator<javax.validation.constraints.NotEmpty, Collection<?>>
{
 
     @Override
     public boolean isValid(Collection<?> value, ConstraintValidatorContext context)
{

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
index b5a4f49..6a5221e 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
@@ -25,11 +25,7 @@ import java.util.Map;
 /**
  * Description: <br/>
  */
-public class NotEmptyValidatorForMap implements ConstraintValidator<NotEmpty, Map<?,
?>> {
-    @Override
-    public void initialize(NotEmpty constraintAnnotation) {
-        // do nothing
-    }
+public class NotEmptyValidatorForMap implements ConstraintValidator<javax.validation.constraints.NotEmpty,
Map<?, ?>> {
 
     @Override
     public boolean isValid(Map<?, ?> value, ConstraintValidatorContext context) {

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
index 9fc3023..c5c8b5e 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
@@ -24,11 +24,7 @@ import javax.validation.ConstraintValidatorContext;
 /**
  * Description: <br/>
  */
-public class NotEmptyValidatorForString implements ConstraintValidator<NotEmpty, String>
{
-    @Override
-    public void initialize(NotEmpty constraintAnnotation) {
-        // do nothing
-    }
+public class NotEmptyValidatorForString implements ConstraintValidator<javax.validation.constraints.NotEmpty,
String> {
 
     @Override
     public boolean isValid(String value, ConstraintValidatorContext context) {

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/NotNullValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/NotNullValidator.java b/bval-jsr/src/main/java/org/apache/bval/constraints/NotNullValidator.java
index b39d493..c14cff2 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/NotNullValidator.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/NotNullValidator.java
@@ -24,10 +24,6 @@ import javax.validation.constraints.NotNull;
 
 /** valid when object is NOT null */
 public class NotNullValidator implements ConstraintValidator<NotNull, Object> {
-    @Override
-    public void initialize(NotNull constraintAnnotation) {
-        // do nothing
-    }
 
     @Override
     public boolean isValid(Object value, ConstraintValidatorContext context) {

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/NullValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/NullValidator.java b/bval-jsr/src/main/java/org/apache/bval/constraints/NullValidator.java
index 7c16296..523ef75 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/NullValidator.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/NullValidator.java
@@ -28,11 +28,6 @@ import javax.validation.constraints.Null;
 public class NullValidator implements ConstraintValidator<Null, Object> {
 
     @Override
-    public void initialize(Null annotation) {
-        // do nothing
-    }
-
-    @Override
     public boolean isValid(Object object, ConstraintValidatorContext context) {
         return object == null;
     }

http://git-wip-us.apache.org/repos/asf/bval/blob/8f19bcb5/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java b/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java
index 9534e6b..8a53062 100644
--- a/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java
+++ b/bval-jsr/src/main/java/org/apache/bval/constraints/PatternValidator.java
@@ -27,7 +27,7 @@ import java.util.regex.PatternSyntaxException;
  * validator using a regular expression,
  * based on the jsr Pattern constraint annotation.
  */
-public class PatternValidator implements ConstraintValidator<Pattern, String> {
+public class PatternValidator implements ConstraintValidator<Pattern, CharSequence>
{
     protected java.util.regex.Pattern pattern;
 
     @Override
@@ -46,7 +46,7 @@ public class PatternValidator implements ConstraintValidator<Pattern,
String> {
     }
 
     @Override
-    public boolean isValid(String value, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence value, ConstraintValidatorContext context) {
         return value == null || pattern.matcher(value).matches();
     }
 }


Mime
View raw message