Author: hardy.ferentschik
Date: 2010-04-30 04:11:15 -0400 (Fri, 30 Apr 2010)
New Revision: 19327
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/CreditCardNumber.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotBlank.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/ScriptAssert.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/URL.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html
Log:
HV-314 added inner list annotation to be consistent with the bv constraint and follow the
spec's recommodation
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/CreditCardNumber.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/CreditCardNumber.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/CreditCardNumber.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -37,6 +37,7 @@
* credit card number. This is the Luhn algorithm implementation
* which aims to check for user mistake, not credit card validity!
*
+ * @author Hardy Ferentschik
* @author Emmanuel Bernard
*/
@Documented
@@ -49,4 +50,14 @@
public abstract Class<?>[] groups() default { };
public abstract Class<? extends Payload>[] payload() default { };
+
+ /**
+ * Defines several {@code @CreditCardNumber} annotations on the same element.
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface List {
+ CreditCardNumber[] value();
+ }
}
\ No newline at end of file
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Email.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -18,19 +18,20 @@
package org.hibernate.validator.constraints;
import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+import org.hibernate.validator.constraints.impl.EmailValidator;
+
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 java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-import org.hibernate.validator.constraints.impl.EmailValidator;
-
/**
* The string has to be a well-formed email address.
*
@@ -47,4 +48,14 @@
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
+
+ /**
+ * Defines several {@code @Email} annotations on the same element.
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface List {
+ Email[] value();
+ }
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Length.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -18,20 +18,20 @@
package org.hibernate.validator.constraints;
import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.PARAMETER;
import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
import org.hibernate.validator.constraints.impl.LengthValidator;
+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;
+
/**
* Validate that the string is between min and max included.
*
@@ -52,4 +52,14 @@
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
+
+ /**
+ * Defines several {@code @Length} annotations on the same element.
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface List {
+ Length[] value();
+ }
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotBlank.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotBlank.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotBlank.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -1,5 +1,5 @@
/*
- * $Id:$
+ * $Id$
*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -53,4 +53,14 @@
public abstract Class<?>[] groups() default { };
public abstract Class<? extends Payload>[] payload() default { };
+
+ /**
+ * Defines several {@code @NotBlank} annotations on the same element.
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface List {
+ NotBlank[] value();
+ }
}
\ No newline at end of file
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/NotEmpty.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -18,13 +18,7 @@
package org.hibernate.validator.constraints;
import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.PARAMETER;
import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@@ -32,6 +26,13 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
+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;
+
/**
* Asserts that the annotated string, collection, map or array is not {@code null} or
empty.
*
@@ -51,4 +52,14 @@
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
+
+ /**
+ * Defines several {@code @NotEmpty} annotations on the same element.
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface List {
+ NotEmpty[] value();
+ }
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/Range.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -18,13 +18,7 @@
package org.hibernate.validator.constraints;
import java.lang.annotation.Documented;
-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 java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.OverridesAttribute;
@@ -33,6 +27,13 @@
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
+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;
+
/**
* The annotated element has to be in the appropriate range. Apply on numeric values or
string
* representation of the numeric value.
@@ -47,15 +48,23 @@
@Max(Long.MAX_VALUE)
@ReportAsSingleViolation
public @interface Range {
- @OverridesAttribute(constraint = Min.class, name = "value")
- long min() default 0;
+ @OverridesAttribute(constraint = Min.class, name = "value") long min() default
0;
- @OverridesAttribute(constraint = Max.class, name = "value")
- long max() default Long.MAX_VALUE;
+ @OverridesAttribute(constraint = Max.class, name = "value") long max() default
Long.MAX_VALUE;
String message() default
"{org.hibernate.validator.constraints.Range.message}";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
+
+ /**
+ * Defines several {@code @Range} annotations on the same element.
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface List {
+ Range[] value();
+ }
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/ScriptAssert.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/ScriptAssert.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/ScriptAssert.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -125,10 +125,7 @@
String alias() default "_this";
/**
- * Defines several @ScriptAssert annotations on the same element.
- *
- * @author Gunnar Morling
- * @see ScriptAssert
+ * Defines several {@code @ScriptAssert} annotations on the same element.
*/
@Target({ TYPE })
@Retention(RUNTIME)
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/URL.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/URL.java 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/URL.java 2010-04-30
08:11:15 UTC (rev 19327)
@@ -53,4 +53,14 @@
public abstract Class<?>[] groups() default { };
public abstract Class<? extends Payload>[] payload() default { };
+
+ /**
+ * Defines several {@code @URL} annotations on the same element.
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface List {
+ URL[] value();
+ }
}
\ No newline at end of file
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html 2010-04-29
22:12:50 UTC (rev 19326)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/constraints/package.html 2010-04-30
08:11:15 UTC (rev 19327)
@@ -4,7 +4,7 @@
<!--
JBoss, Home of Professional Open Source
- Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+ Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -21,6 +21,7 @@
-->
</head>
<body>
-This package contains the Hibernate Validator specific constraints.
+This package contains the Hibernate Validator specific constraints. Classes in this
package are part of the public Hibernate
+Validator API.
</body>
</html>