You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2009/10/15 18:23:08 UTC
svn commit: r825553 - in
/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation:
./ constraints/
Author: niallp
Date: Thu Oct 15 16:23:07 2009
New Revision: 825553
URL: http://svn.apache.org/viewvc?rev=825553&view=rev
Log:
Add javadocs for Contraints
Added:
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/package.html (with props)
Modified:
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/Constraint.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertFalse.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertTrue.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Digits.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Future.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Max.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Min.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/NotNull.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Null.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Past.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Pattern.java
commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Size.java
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/Constraint.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/Constraint.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/Constraint.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/Constraint.java Thu Oct 15 16:23:07 2009
@@ -16,6 +16,7 @@
*/
package javax.validation;
+import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -23,8 +24,35 @@
import java.lang.annotation.Target;
/**
- * Validation Constraint.
+ * {@link Annotation} which indicates that an {@link Annotation} is a
+ * validation constraint and the {@link ConstraintValidator}s that
+ * implement validation for it.
*
+ * <h3>Defining a new validation constraint</h3>
+ *
+ * Define a new {@link Annotation} with the following:
+ *
+ * <ul>
+ * <li>The retention policy should be {@link RetentionPolicy#RUNTIME}</li>
+ * <li>It should be annotated by <code>@Constraint</code></li>
+ * <li>The annotation should target the following program elements:</li>
+ * <ul>
+ * <li>{@link ElementType#ANNOTATION_TYPE}</li>
+ * <li>{@link ElementType#CONSTRUCTOR}</li>
+ * <li>{@link ElementType#FIELD}</li>
+ * <li>{@link ElementType#METHOD}</li>
+ * <li>{@link ElementType#PARAMETER}</li>
+ * </ul>
+ * <li>The annotation should have the following properties
+ * (see {@link javax.validation.constraints.NotNull}
+ * for example):</li>
+ * <ul>
+ * <li><code>groups</code></li>
+ * <li><code>message</code></li>
+ * <li><code>payload</code></li>
+ * </ul>
+ * </ul>
+ *
* @version $Revision$ $Date$
* @since 1.0
*/
@@ -33,6 +61,13 @@
@Target(ElementType.ANNOTATION_TYPE)
public @interface Constraint {
+ /**
+ * Return the validators which implement the validation for the constraint.
+ * <p/>
+ * Each {@link ConstraintValidator} must be for a different value type.
+ *
+ * @return The validators which implement the validation for the constraint
+ */
public Class<? extends ConstraintValidator<?, ?>>[] validatedBy();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertFalse.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertFalse.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertFalse.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertFalse.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,7 @@
import javax.validation.Payload;
/**
- * Assert False Constraint.
+ * Validation {@link Constraint} that a value must be false.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,20 +41,44 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface AssertFalse {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.AssertFalse.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
/**
- * Assert False Constraint List.
+ * List of {@link AssertFalse} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return assert false constraints.
+ *
+ * @return assert false constraints
+ */
AssertFalse[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertTrue.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertTrue.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertTrue.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/AssertTrue.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,7 @@
import javax.validation.Payload;
/**
- * Assert True Constraint.
+ * Validation {@link Constraint} that a value must be true.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,20 +41,44 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface AssertTrue {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.AssertTrue.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
/**
- * Assert True Constraint List.
+ * List of {@link AssertTrue} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return assert true constraints.
+ *
+ * @return assert true constraints
+ */
AssertTrue[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,8 @@
import javax.validation.Payload;
/**
- * Decimal Max Constraint.
+ * Validation {@link Constraint} that specifies the maximum of
+ * a decimal value.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,22 +42,51 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface DecimalMax {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.DecimalMax.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
+ /**
+ * The maximum value.
+ *
+ * @return The maximum value
+ */
String value();
/**
- * Decimal Max Constraint List.
+ * List of {@link DecimalMax} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return maximum decimal constraints.
+ *
+ * @return maximum decimal constraints
+ */
DecimalMax[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,8 @@
import javax.validation.Payload;
/**
- * Decimal Min Constraint.
+ * Validation {@link Constraint} that specifies the minimum of
+ * a decimal value.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,22 +42,51 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface DecimalMin {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.DecimalMin.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
+ /**
+ * The minimum value.
+ *
+ * @return The minimum value
+ */
String value();
/**
- * Decimal Min Constraint List.
+ * List of {@link DecimalMin} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return minimum decimal constraints.
+ *
+ * @return minimum decimal constraints
+ */
DecimalMin[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Digits.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Digits.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Digits.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Digits.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,8 @@
import javax.validation.Payload;
/**
- * Digits Constraint.
+ * Validation {@link Constraint} that specifies the maximum number of
+ * integer and fraction digits in a numeric value.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,24 +42,58 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Digits {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Digits.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
+ /**
+ * Return the maximum fraction digits allowed.
+ *
+ * @return the maximum fraction digits allowed
+ */
int fraction();
+ /**
+ * Return the maximum integer digits allowed.
+ *
+ * @return the maximum integer digits allowed
+ */
int integer();
/**
- * Digits Constraint List.
+ * List of {@link Digits} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return maximum/minimum digits constraints.
+ *
+ * @return maximum/minimum digits constraints
+ */
Digits[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Future.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Future.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Future.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Future.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,7 @@
import javax.validation.Payload;
/**
- * Future Constraint.
+ * Validation {@link Constraint} that a date value must be in the future.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,20 +41,44 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Future {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Future.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
/**
- * Future Constraint List.
+ * List of {@link Future} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return future date constraints.
+ *
+ * @return future date constraints
+ */
Future[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Max.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Max.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Max.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Max.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,8 @@
import javax.validation.Payload;
/**
- * Max Constraint.
+ * Validation {@link Constraint} that specifies the maximum of
+ * a numeric value.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,22 +42,51 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Max {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Max.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
+ /**
+ * The maximum value.
+ *
+ * @return The maximum value
+ */
long value();
/**
- * Max Constraint List.
+ * List of {@link Max} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return maximum constraints.
+ *
+ * @return maximum constraints
+ */
Max[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Min.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Min.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Min.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Min.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,8 @@
import javax.validation.Payload;
/**
- * Min Constraint.
+ * Validation {@link Constraint} that specifies the minimum of
+ * a numeric value.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,22 +42,51 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Min {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Min.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
+ /**
+ * The minimum value.
+ *
+ * @return The minimum value
+ */
long value();
/**
- * Min Constraint List.
+ * List of {@link Min} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return minimum constraints.
+ *
+ * @return minimum constraints
+ */
Min[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/NotNull.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/NotNull.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/NotNull.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/NotNull.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,7 @@
import javax.validation.Payload;
/**
- * Not Null Constraint.
+ * Validation {@link Constraint} that a value must not be null.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,20 +41,44 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface NotNull {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.NotNull.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
/**
- * Not Null Constraint List.
+ * List of {@link NotNull} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return not-null constraints.
+ *
+ * @return not-null constraints
+ */
NotNull[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Null.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Null.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Null.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Null.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,7 @@
import javax.validation.Payload;
/**
- * Null Constraint.
+ * Validation {@link Constraint} that a value must be null.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,20 +41,44 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Null {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Null.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
/**
- * Null Constraint List.
+ * List of {@link Null} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return null constraints.
+ *
+ * @return null constraints
+ */
Null[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Past.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Past.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Past.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Past.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,7 @@
import javax.validation.Payload;
/**
- * Past Constraint.
+ * Validation {@link Constraint} that a date value must be in the past.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,20 +41,44 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Past {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Past.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
/**
- * Past Constraint List.
+ * List of {@link Past} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return past date constraints.
+ *
+ * @return past date constraints
+ */
Past[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Pattern.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Pattern.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Pattern.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Pattern.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,8 @@
import javax.validation.Payload;
/**
- * Pattern Constraint.
+ * Validation {@link Constraint} that specifies a regular
+ * expression that a value must match.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,27 +42,99 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Pattern {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Pattern.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
+ /**
+ * Return the flags to use when matching the regular expression.
+ *
+ * @return the flags to use when matching the regular expression
+ */
Flag[] flags() default {};
+ /**
+ * The regular expression used to validate.
+ *
+ * @return regular expression used to validate
+ */
String regexp();
/**
* Regular expression flag values.
+ *
+ * @see java.util.regex.Pattern
*/
public static enum Flag {
+ /**
+ * Canonical equivalence.
+ *
+ * see {@link java.util.regex.Pattern#CANON_EQ}
+ */
CANON_EQ(java.util.regex.Pattern.CANON_EQ),
+
+ /**
+ * Case-insensitive matching.
+ *
+ * see {@link java.util.regex.Pattern#CASE_INSENSITIVE}
+ */
CASE_INSENSITIVE(java.util.regex.Pattern.CASE_INSENSITIVE),
+
+ /**
+ * Allow whitespace and comments.
+ *
+ * see {@link java.util.regex.Pattern#COMMENTS}
+ */
COMMENTS(java.util.regex.Pattern.COMMENTS),
+
+ /**
+ * Dotall mode.
+ *
+ * see {@link java.util.regex.Pattern#DOTALL}
+ */
DOTALL(java.util.regex.Pattern.DOTALL),
+
+ /**
+ * Multiline mode.
+ *
+ * see {@link java.util.regex.Pattern#MULTILINE}
+ */
MULTILINE(java.util.regex.Pattern.MULTILINE),
+
+ /**
+ * Unicode-aware case.
+ *
+ * see {@link java.util.regex.Pattern#UNICODE_CASE}
+ */
UNICODE_CASE(java.util.regex.Pattern.UNICODE_CASE),
+
+ /**
+ * Unix lines mode.
+ *
+ * see {@link java.util.regex.Pattern#UNIX_LINES}
+ */
UNIX_LINES(java.util.regex.Pattern.UNIX_LINES);
private final int value;
@@ -69,19 +142,30 @@
private Flag(int value) {
this.value = value;
}
+
+ /**
+ * Return the flag value.
+ *
+ * @return the flag value
+ */
public int getValue() {
return value;
}
}
/**
- * Pattern Constraint List.
+ * List of {@link Pattern} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return regular expression constraints.
+ *
+ * @return regular expression constraints
+ */
Pattern[] value();
}
Modified: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Size.java
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Size.java?rev=825553&r1=825552&r2=825553&view=diff
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Size.java (original)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/Size.java Thu Oct 15 16:23:07 2009
@@ -30,7 +30,8 @@
import javax.validation.Payload;
/**
- * Size Constraint.
+ * Validation {@link Constraint} that specifies the minimum
+ * and maximum size of a value.
*
* @version $Revision$ $Date$
* @since 1.0
@@ -41,24 +42,58 @@
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface Size {
+ /**
+ * Return the associated processing groups.
+ * <p/>
+ * If none is specified the {@link javax.validation.groups.Default}
+ * group is assumed.
+ *
+ * @return the associated processing groups
+ */
Class<?>[] groups() default {};
+ /**
+ * Return the message element.
+ *
+ * @return the message element
+ */
String message() default "{javax.validation.constraints.Size.message}";
+ /**
+ * Return the associated payloads.
+ *
+ * @return the associated payloads
+ * @see Payload
+ */
Class<? extends Payload>[] payload() default {};
+ /**
+ * The minimum size.
+ *
+ * @return The minimum size
+ */
int min() default 0;
+ /**
+ * The maximum size.
+ *
+ * @return The maximum size
+ */
int max() default Integer.MAX_VALUE;
/**
- * Size Constraint List.
+ * List of {@link Size} Constraints.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ANNOTATION_TYPE, CONSTRUCTOR, FIELD, METHOD, PARAMETER})
public @interface List {
+ /**
+ * Return size constraints.
+ *
+ * @return size constraints
+ */
Size[] value();
}
Added: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/package.html
URL: http://svn.apache.org/viewvc/commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/package.html?rev=825553&view=auto
==============================================================================
--- commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/package.html (added)
+++ commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/package.html Thu Oct 15 16:23:07 2009
@@ -0,0 +1,26 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+ <title>Package Documentation for javax.validation.constraints</title>
+</head>
+<body bgcolor="white">
+<p>
+ Built in constraints that are part of the Bean Validation specification.
+</p>
+</body>
+</html>
Propchange: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/validator2/branches/alternative/validation-api/src/main/java/javax/validation/constraints/package.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL