bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject [04/15] bval git commit: bval-extras updates
Date Wed, 15 Nov 2017 22:54:09 GMT
bval-extras updates


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

Branch: refs/heads/bv2
Commit: b53e4a0c508251b17752489dca5c8e2362eaff2d
Parents: 99eb42a
Author: Matt Benson <mbenson@apache.org>
Authored: Wed Nov 15 14:59:16 2017 -0600
Committer: Matt Benson <mbenson@apache.org>
Committed: Wed Nov 15 16:53:42 2017 -0600

----------------------------------------------------------------------
 .../constraints/checkdigit/ABANumber.java       |  4 ++-
 .../extras/constraints/checkdigit/CUSIP.java    |  4 ++-
 .../extras/constraints/checkdigit/EAN13.java    |  4 ++-
 .../extras/constraints/checkdigit/IBAN.java     |  4 ++-
 .../constraints/checkdigit/IBANValidator.java   |  8 ++---
 .../extras/constraints/checkdigit/ISBN10.java   |  4 ++-
 .../extras/constraints/checkdigit/Luhn.java     |  4 ++-
 .../checkdigit/ModulusValidator.java            |  4 +--
 .../extras/constraints/checkdigit/Sedol.java    |  4 ++-
 .../extras/constraints/checkdigit/Verhoeff.java |  4 ++-
 .../checkdigit/VerhoeffValidator.java           |  4 +--
 .../constraints/creditcard/AmericanExpress.java |  4 ++-
 .../extras/constraints/creditcard/Diners.java   |  4 ++-
 .../extras/constraints/creditcard/Discover.java |  4 ++-
 .../constraints/creditcard/Mastercard.java      |  4 ++-
 .../constraints/file/DirectoryValidator.java    |  2 +-
 .../constraints/file/SymlinkValidator.java      |  2 +-
 .../extras/constraints/net/DomainValidator.java | 33 ++++++++++----------
 .../constraints/net/InetAddressValidator.java   |  4 +--
 .../checkdigit/ABANumberValidatorTest.java      |  2 +-
 .../checkdigit/AbstractCheckDigitTest.java      |  4 +--
 .../checkdigit/CUSIPValidatorTest.java          |  2 +-
 .../checkdigit/EAN13CheckDigitTest.java         |  2 +-
 .../checkdigit/IBANCheckDigitTest.java          |  2 +-
 .../checkdigit/ISBN10CheckDigitTest.java        |  2 +-
 .../checkdigit/LuhnCheckDigitTest.java          |  2 +-
 .../checkdigit/SedolCheckDigitTest.java         |  2 +-
 .../checkdigit/VerhoeffCheckDigitTest.java      |  2 +-
 .../net/InetAddressValidatorTest.java           |  2 +-
 29 files changed, 75 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java
index 921ffbc..821b6aa 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ABANumber.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = ABANumberValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface ABANumber {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java
index 85e84fd..139ab50 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/CUSIP.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = CUSIPValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface CUSIP {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java
index 4f835f6..667c786 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/EAN13.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = EAN13Validator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface EAN13 {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java
index f0685c0..c48173f 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBAN.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = IBANValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface IBAN {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java
index 38eace6..1f392c7 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/IBANValidator.java
@@ -26,7 +26,7 @@ import static java.lang.Character.getNumericValue;
 /**
  * <b>IBAN</b> (International Bank Account Number) Check Digit calculation/validation.
  * <p>
- * This rountine is based on the ISO 7064 Mod 97,10 check digit caluclation routine.
+ * This routine is based on the ISO 7064 Mod 97,10 check digit caluclation routine.
  * <p>
  * The two check digit characters in a IBAN number are the third and fourth characters
  * in the code. For <i>check digit</i> calculation/validation the first four
characters are moved
@@ -40,7 +40,7 @@ import static java.lang.Character.getNumericValue;
  *  <a href="http://en.wikipedia.org/wiki/International_Bank_Account_Number">Wikipedia
-
  *  IBAN number</a>.
  */
-public final class IBANValidator implements ConstraintValidator<IBAN, String> {
+public final class IBANValidator implements ConstraintValidator<IBAN, CharSequence>
{
 
     private static final long MAX = 999999999;
 
@@ -50,12 +50,12 @@ public final class IBANValidator implements ConstraintValidator<IBAN,
String> {
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String code, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence code, ConstraintValidatorContext context) {
         if (code.length() < 5) {
             return false;
         }
 
-        String reformattedCode = code.substring(4) + code.substring(0, 4);
+        String reformattedCode = code.subSequence(4, code.length()).toString() + code.subSequence(0,
4).toString();
         long total = 0;
         for (int i = 0; i < reformattedCode.length(); i++) {
             int charValue = getNumericValue(reformattedCode.charAt(i));

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java
index a3a1bc3..9ce9b19 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ISBN10.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = ISBN10Validator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface ISBN10 {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java
index 3bc186e..4e7ede5 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Luhn.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = LuhnValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Luhn {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java
index f25bea4..57d463d 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/ModulusValidator.java
@@ -38,7 +38,7 @@ import static java.lang.Character.isDigit;
  *
  * @param <A>
  */
-abstract class ModulusValidator<A extends Annotation> implements ConstraintValidator<A,
String> {
+abstract class ModulusValidator<A extends Annotation> implements ConstraintValidator<A,
CharSequence> {
 
     private final int modulus;
 
@@ -58,7 +58,7 @@ abstract class ModulusValidator<A extends Annotation> implements ConstraintValid
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String code, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence code, ConstraintValidatorContext context) {
         if (code.length() == 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java
index e69947c..67a2c01 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Sedol.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = SedolValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Sedol {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java
index e051a39..d3afc67 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/Verhoeff.java
@@ -25,7 +25,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -40,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  */
 @Documented
 @Constraint(validatedBy = VerhoeffValidator.class)
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Verhoeff {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java
index 5a7d76b..b6c6249 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffValidator.java
@@ -33,7 +33,7 @@ import static java.lang.Character.getNumericValue;
  * See <a href="http://en.wikipedia.org/wiki/Verhoeff_algorithm">Wikipedia
  *  - Verhoeff algorithm</a> for more details.
  */
-public final class VerhoeffValidator implements ConstraintValidator<Verhoeff, String>
{
+public final class VerhoeffValidator implements ConstraintValidator<Verhoeff, CharSequence>
{
 
     //@formatter:off
     /** D - multiplication table */
@@ -65,7 +65,7 @@ public final class VerhoeffValidator implements ConstraintValidator<Verhoeff,
St
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String code, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence code, ConstraintValidatorContext context) {
         if (code.length() == 0) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java
index 3d08d19..051d210 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java
@@ -28,7 +28,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
 @Luhn
 @Pattern(regexp = "^(3[47]\\d{13})$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface AmericanExpress {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java
index de6fd35..efb0772 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java
@@ -28,7 +28,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
 @Luhn
 @Pattern(regexp = "^(30[0-5]\\d{11}|3095\\d{10}|36\\d{12}|3[8-9]\\d{12})$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Diners {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java
index c445837..4e5ddd5 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java
@@ -28,7 +28,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
 @Luhn
 @Pattern(regexp = "^((6011\\d{12})|(64[4-9]\\d{13})|(65\\d{14}))$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Discover {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java
index f30482e..1a9b6a5 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java
@@ -28,7 +28,9 @@ 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.RetentionPolicy.RUNTIME;
 
@@ -45,7 +47,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
 @Luhn
 @Pattern(regexp = "^(5[1-5]\\d{14})$")
 @Constraint(validatedBy = {})
-@Target({ FIELD, ANNOTATION_TYPE, PARAMETER })
+@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
 @Retention(RUNTIME)
 public @interface Mastercard {
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java
index a95ebde..6bca3b7 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/DirectoryValidator.java
@@ -32,7 +32,7 @@ public class DirectoryValidator implements ConstraintValidator<Directory,
File>
      */
     @Override
     public boolean isValid(File value, ConstraintValidatorContext context) {
-        return value.exists() && value.isDirectory();
+        return value.isDirectory();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java
index 6ed85fd..ef85896 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/file/SymlinkValidator.java
@@ -49,7 +49,7 @@ public class SymlinkValidator implements ConstraintValidator<Symlink,
File> {
         }
 
         try {
-            File fileInCanonicalDir = null;
+            File fileInCanonicalDir;
             if (value.getParent() == null) {
                 fileInCanonicalDir = value;
             } else {

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java
index b989531..c7668d5 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/DomainValidator.java
@@ -20,11 +20,12 @@ package org.apache.bval.extras.constraints.net;
 
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;
-import java.util.List;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import static java.util.Arrays.asList;
+import java.util.Arrays;
+import java.util.HashSet;
 
 /**
  * <p><b>Domain name</b> validation routines.</p>
@@ -63,7 +64,7 @@ import static java.util.Arrays.asList;
  * {@link java.net.InetAddress} for that functionality.)
  * </p>
  */
-public class DomainValidator implements ConstraintValidator<Domain, String> {
+public class DomainValidator implements ConstraintValidator<Domain, CharSequence> {
 
     private boolean allowLocal;
 
@@ -77,15 +78,13 @@ public class DomainValidator implements ConstraintValidator<Domain,
String> {
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String domain, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence domain, ConstraintValidatorContext context) {
         Matcher matcher = DOMAIN_NAME_REGEX.matcher(domain);
         if (matcher.matches()) {
             domain = matcher.group(1);
-            return isValidTld(domain);
-        } else if (allowLocal && DOMAIN_LABEL.matcher(domain).matches()) {
-            return true;
+            return isValidTld(domain.toString());
         }
-        return false;
+        return allowLocal && DOMAIN_LABEL.matcher(domain).matches();
     }
 
     /**
@@ -154,7 +153,7 @@ public class DomainValidator implements ConstraintValidator<Domain,
String> {
     }
 
     private static String chompLeadingDot(String str) {
-        if (str.startsWith(".")) {
+        if (str.charAt(0) == '.') {
             return str.substring(1);
         }
         return str;
@@ -165,11 +164,11 @@ public class DomainValidator implements ConstraintValidator<Domain,
String> {
     // ----- Authoritative and comprehensive list at:
     // ----- http://data.iana.org/TLD/tlds-alpha-by-domain.txt
 
-    private static final List<String> INFRASTRUCTURE_TLDS = asList("arpa", // internet
infrastructure
+    private static final Set<String> INFRASTRUCTURE_TLDS = new HashSet<>(Arrays.asList("arpa",
// internet infrastructure
         "root" // diagnostic marker for non-truncated root zone
-    );
+    ));
 
-    private static final List<String> GENERIC_TLDS = asList("aero", // air transport
industry
+    private static final Set<String> GENERIC_TLDS = new HashSet<>(Arrays.asList("aero",
// air transport industry
         "asia", // Pan-Asia/Asia Pacific
         "biz", // businesses
         "cat", // Catalan linguistic/cultural community
@@ -189,9 +188,9 @@ public class DomainValidator implements ConstraintValidator<Domain,
String> {
         "edu", // accredited postsecondary US education entities
         "mil", // United States Military
         "int" // organizations established by international treaty
-    );
+    ));
 
-    private static final List<String> COUNTRY_CODE_TLDS = asList("ac", // Ascension
Island
+    private static final Set<String> COUNTRY_CODE_TLDS = new HashSet<>(Arrays.asList("ac",
// Ascension Island
         "ad", // Andorra
         "ae", // United Arab Emirates
         "af", // Afghanistan
@@ -440,11 +439,11 @@ public class DomainValidator implements ConstraintValidator<Domain,
String> {
         "za", // South Africa
         "zm", // Zambia
         "zw" // Zimbabwe
-    );
+    ));
 
-    private static final List<String> LOCAL_TLDS = asList("localhost", // RFC2606 defined
+    private static final Set<String> LOCAL_TLDS = new HashSet<>(Arrays.asList("localhost",
// RFC2606 defined
         "localdomain" // Also widely used as localhost.localdomain
-    );
+    ));
 
     /**
      * {@inheritDoc}

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java
b/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java
index 461562c..d482e01 100644
--- a/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java
+++ b/bval-extras/src/main/java/org/apache/bval/extras/constraints/net/InetAddressValidator.java
@@ -27,7 +27,7 @@ import java.util.regex.Pattern;
  *
  * <p>This class provides methods to validate a candidate IP address.
  */
-public class InetAddressValidator implements ConstraintValidator<InetAddress, String>
{
+public class InetAddressValidator implements ConstraintValidator<InetAddress, CharSequence>
{
 
     private static final Pattern IPV4_PATTERN =
         Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\."
@@ -37,7 +37,7 @@ public class InetAddressValidator implements ConstraintValidator<InetAddress,
St
      * {@inheritDoc}
      */
     @Override
-    public boolean isValid(String value, ConstraintValidatorContext context) {
+    public boolean isValid(CharSequence value, ConstraintValidatorContext context) {
         if (!IPV4_PATTERN.matcher(value).matches()) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
index d186dcb..8cd2399 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ABANumberValidatorTest.java
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class ABANumberValidatorTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new ABANumberValidator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
index c25278f..190bd5b 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/AbstractCheckDigitTest.java
@@ -37,7 +37,7 @@ public abstract class AbstractCheckDigitTest {
     private int checkDigitLth;
 
     /** Check digit routine being tested */
-    private ConstraintValidator<? extends Annotation, String> routine;
+    private ConstraintValidator<? extends Annotation, ? super String> routine;
 
     /** Array of valid code values */
     private String[] valid;
@@ -55,7 +55,7 @@ public abstract class AbstractCheckDigitTest {
         return 1;
     }
 
-    protected abstract ConstraintValidator<? extends Annotation, String> getConstraint();
+    protected abstract ConstraintValidator<? extends Annotation, ? super String> getConstraint();
 
     protected abstract String[] getValid();
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java
index 5bc57c3..fe13c4b 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/CUSIPValidatorTest.java
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class CUSIPValidatorTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new CUSIPValidator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java
index 83cbf63..052a1c9 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/EAN13CheckDigitTest.java
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class EAN13CheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new EAN13Validator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java
index c0ea8e6..04cfd73 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/IBANCheckDigitTest.java
@@ -35,7 +35,7 @@ public class IBANCheckDigitTest extends AbstractCheckDigitTest {
     }
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new IBANValidator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java
index f03e7a1..4940c8b 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/ISBN10CheckDigitTest.java
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class ISBN10CheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new ISBN10Validator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java
index 06263e7..2b09d50 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/LuhnCheckDigitTest.java
@@ -37,7 +37,7 @@ public class LuhnCheckDigitTest extends AbstractCheckDigitTest {
     private static final String VALID_DINERS     = "30569309025904";
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new LuhnValidator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java
index 73ea523..55d1f51 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/SedolCheckDigitTest.java
@@ -25,7 +25,7 @@ import java.lang.annotation.Annotation;
 public class SedolCheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new SedolValidator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java
index 2c6e982..fbd3c7f 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/checkdigit/VerhoeffCheckDigitTest.java
@@ -28,7 +28,7 @@ import java.lang.annotation.Annotation;
 public class VerhoeffCheckDigitTest extends AbstractCheckDigitTest {
 
     @Override
-    protected ConstraintValidator<? extends Annotation, String> getConstraint() {
+    protected ConstraintValidator<? extends Annotation, ? super String> getConstraint()
{
         return new VerhoeffValidator();
     }
 

http://git-wip-us.apache.org/repos/asf/bval/blob/b53e4a0c/bval-extras/src/test/java/org/apache/bval/extras/constraints/net/InetAddressValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-extras/src/test/java/org/apache/bval/extras/constraints/net/InetAddressValidatorTest.java
b/bval-extras/src/test/java/org/apache/bval/extras/constraints/net/InetAddressValidatorTest.java
index 9eba6ec..a79430d 100644
--- a/bval-extras/src/test/java/org/apache/bval/extras/constraints/net/InetAddressValidatorTest.java
+++ b/bval-extras/src/test/java/org/apache/bval/extras/constraints/net/InetAddressValidatorTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertTrue;
 /**
  * Test cases for InetAddressValidator.
  *
- * @version $Revision$
+ * @version $Revision: 1766546 $
  */
 public class InetAddressValidatorTest {
 


Mime
View raw message