Skip to content

Commit

Permalink
Merge 4aa1ce5 into df45b07
Browse files Browse the repository at this point in the history
  • Loading branch information
Osguima3 committed Apr 11, 2018
2 parents df45b07 + 4aa1ce5 commit bf5d564
Show file tree
Hide file tree
Showing 20 changed files with 589 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: java
jdk:
- openjdk7
- oraclejdk8
env:
global:
Expand All @@ -13,6 +12,7 @@ env:
- HV_VERSION=5.2.5.Final
- HV_VERSION=5.3.5.Final
- HV_VERSION=5.4.1.Final
- HV_VERSION=6.0.4.Final

# Cache local Maven repository
cache:
Expand Down
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@
</issueManagement>


<!--//////////////////// PROPERTIES ////////////////////-->
<properties>
<!-- Note: Should be updated in parent pom. (Fixes Java 8 annotation target TYPE_USE in tests) -->
<groovy.version>2.4.15</groovy.version>
</properties>


<!--//////////////////// DEPENDENCIES ////////////////////-->

<dependencies>
Expand All @@ -73,7 +80,7 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<!-- Note: Minimal supported version is 4.3.0.Final. -->
<version>5.4.1.Final</version>
<version>6.0.4.Final</version>
</dependency>

<dependency>
Expand All @@ -86,7 +93,7 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;
import org.hibernate.validator.constraints.CodePointLength;
import org.hibernate.validator.constraints.CodePointLength.NormalizationStrategy;

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.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @since Hibernate Validator 6.0.3
* @see CodePointLength
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@EachConstraint(validateAs = CodePointLength.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachCodePointLength {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };

int min() default 0;

int max() default Integer.MAX_VALUE;

NormalizationStrategy normalizationStrategy() default NormalizationStrategy.NONE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;
import org.hibernate.validator.constraints.Email;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Email;
import javax.validation.constraints.Pattern;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
Expand All @@ -42,7 +42,7 @@
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE})
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = Email.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachEmail {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.FutureOrPresent;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see FutureOrPresent
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = FutureOrPresent.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachFutureOrPresent {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
Class<? extends Payload>[] payload() default { };

/**
* @return The threshold for the Mod11 algorithm multiplier growth, if no value is specified the multiplier will grow indefinitely
* @return The threshold for the Mod11 algorithm multiplier growth, if no value is specified the multiplier will
* grow indefinitely
*/
int threshold() default Integer.MAX_VALUE;

Expand All @@ -71,8 +72,8 @@

/**
* @return The index of the check digit in the input. Per default it is assumed that the check digit is the last
* digit of the specified range. If set, the digit at the specified index is used. If set
* the following must hold true:<br/>
* digit of the specified range. If set, the digit at the specified index is used. If set the following must hold
* true:<br/>
* {@code checkDigitIndex > 0 && (checkDigitIndex < startIndex || checkDigitIndex >= endIndex}.
*/
int checkDigitIndex() default -1;
Expand All @@ -96,7 +97,8 @@
char treatCheck11As() default '0';

/**
* @return Returns {@code RIGHT_TO_LEFT} if the Mod11 checksum must be done from the rightmost to the leftmost digit.
* @return Returns {@code RIGHT_TO_LEFT} if the Mod11 checksum must be done from the rightmost to the leftmost
* digit.
* e.g. Code 12345-?:
* <ul>
* <li>{@code RIGHT_TO_LEFT} the sum (5*2 + 4*3 + 3*4 + 2*5 + 1*6) with check digit 5</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Negative;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see Negative
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = Negative.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachNegative {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* The MIT License
*
* Copyright 2013-2014 Jakub Jirutka <jakub@jirutka.cz>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.NegativeOrZero;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see NegativeOrZero
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = NegativeOrZero.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachNegativeOrZero {

String message() default "";

Class<?>[] groups() default { };

Class<? extends Payload>[] payload() default { };
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
*/
package cz.jirutka.validator.collection.constraints;

import cz.jirutka.validator.collection.CommonEachValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.ReportAsSingleViolation;
import javax.validation.constraints.NotEmpty;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand All @@ -34,20 +36,19 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* @see org.hibernate.validator.constraints.NotEmpty
* @see NotEmpty
* @see CommonEachValidator
*/
@Documented
@Retention(RUNTIME)
@Target({METHOD, FIELD, ANNOTATION_TYPE})
@EachNotNull
@EachSize(min = 1)
@ReportAsSingleViolation
@Constraint(validatedBy = { })
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@EachConstraint(validateAs = NotEmpty.class)
@Constraint(validatedBy = CommonEachValidator.class)
public @interface EachNotEmpty {

String message() default "{org.hibernate.validator.constraints.NotEmpty.message}";

Class<?>[] groups() default { };
Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default { };
Class<? extends Payload>[] payload() default {};
}
Loading

0 comments on commit bf5d564

Please sign in to comment.