[hibernate-commits] Hibernate SVN: r17579 - in beanvalidation/api/trunk/src/main/java/javax/validation: groups and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Sep 29 13:10:16 EDT 2009


Author: epbernard
Date: 2009-09-29 13:10:16 -0400 (Tue, 29 Sep 2009)
New Revision: 17579

Modified:
   beanvalidation/api/trunk/src/main/java/javax/validation/Constraint.java
   beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidator.java
   beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java
   beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorFactory.java
   beanvalidation/api/trunk/src/main/java/javax/validation/OverridesAttribute.java
   beanvalidation/api/trunk/src/main/java/javax/validation/groups/Default.java
Log:
Minor JavaDoc enhancements

Modified: beanvalidation/api/trunk/src/main/java/javax/validation/Constraint.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/Constraint.java	2009-09-29 16:34:58 UTC (rev 17578)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/Constraint.java	2009-09-29 17:10:16 UTC (rev 17579)
@@ -28,7 +28,7 @@
 /**
  * Link between a constraint annotation and its constraint validation implementations.
  * <p/>
- * A given constraint annotation should be annotated by a @Constraint
+ * A given constraint annotation should be annotated by a <code>@Constraint</code>
  * annotation which refers to its list of constraint validation implementations.
  *
  * @author Emmanuel Bernard
@@ -39,11 +39,12 @@
 @Target({ ANNOTATION_TYPE })
 @Retention(RUNTIME)
 public @interface Constraint {
-    /**
-     * ConstraintValidator classes must reference distinct target types.
-     * If two validators refer to the same type, an exception will occur.
-     *
-     * @return array of ConstraintValidator classes implementing the constraint
-     */
-    public Class<? extends ConstraintValidator<?,?>>[] validatedBy();
+	/**
+	 * <code>ConstraintValidator</code> classes must reference distinct target types.
+	 * If two <code>ConstraintValidator</code> refer to the same type,
+	 * an exception will occur.
+	 *
+	 * @return array of ConstraintValidator classes implementing the constraint
+	 */
+	public Class<? extends ConstraintValidator<?, ?>>[] validatedBy();
 }
\ No newline at end of file

Modified: beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidator.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidator.java	2009-09-29 16:34:58 UTC (rev 17578)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidator.java	2009-09-29 17:10:16 UTC (rev 17579)
@@ -23,7 +23,11 @@
  * Defines the logic to validate a given constraint A
  * for a given object type T.
  * Implementations must comply to the following restriction:
- * T must resolve to a non parameterized type
+ * <ul>
+ * <li>T must resolve to a non parameterized type</li>
+ * <li>or generic parameters of T must be unbounded
+ * wildcard types</li>
+ * </ul>
  *
  * @author Emmanuel Bernard
  * @author Hardy Ferentschik
@@ -34,8 +38,8 @@
 	 * The constraint annotation for a given constraint declaration
 	 * is passed.
 	 * <p/>
-	 * This method is guaranteed to be called before any of the other Constraint
-	 * implementation methods
+	 * This method is guaranteed to be called before any use of this instance for
+	 * validation.
 	 *
 	 * @param constraintAnnotation annotation instance for a given constraint declaration
 	 */
@@ -43,16 +47,16 @@
 
 	/**
 	 * Implement the validation logic.
-	 * <code>value</code> state must not be altered.
+	 * The state of <code>value</code> must not be altered.
 	 *
 	 * This method can be accessed concurrently, thread-safety must be ensured
 	 * by the implementation.
 	 *
 	 * @param value object to validate
-	 * @param constraintValidatorContext context in which the constraint is evaluated
+	 * @param context context in which the constraint is evaluated
 	 *
 	 * @return false if <code>value</code> does not pass the constraint
 	 */
-	boolean isValid(T value, ConstraintValidatorContext constraintValidatorContext);
+	boolean isValid(T value, ConstraintValidatorContext context);
 }
  
\ No newline at end of file

Modified: beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java	2009-09-29 16:34:58 UTC (rev 17578)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java	2009-09-29 17:10:16 UTC (rev 17579)
@@ -27,9 +27,10 @@
  */
 public interface ConstraintValidatorContext {
 	/**
-	 * Disable the default error message and default ConstraintViolation object generation.
-	 * Useful to set a different error message or generate a ConstraintViolation based on
-	 * a different property
+	 * Disable the default error message and default <code>ConstraintViolation</code> object
+	 * generation.
+	 * Useful to set a different error message or generate a <code>ConstraintViolation</Code>
+	 * based on a different property
 	 */
 	void disableDefaultError();
 
@@ -47,19 +48,19 @@
 	 * the #addError method available in one of the
 	 * interfaces of the fluent API.
 	 * If another method is called after #addError() on
-	 * ErrorBuilder or any of its associated nested interfaces
-	 * an IllegalStateException is raised.
+	 * <code>ErrorBuilder</code> or any of its associated nested interfaces
+	 * an <code>IllegalStateException</code> is raised.
 	 * <p/>
 	 * If <code>isValid<code> returns <code>false</code>, a <code>ConstraintViolation</code>
-	 * object will be built per error including the default one unless
-	 * {@link #disableDefaultError()} has been called.
+	 * object will be built per error including the default one (unless
+	 * {@link #disableDefaultError()} has been called).
 	 * <p/>
 	 * <code>ConstraintViolation</code> objects generated from such a call
 	 * contain the same contextual information (root bean, path and so on) unless
 	 * the path has been overriden.
 	 * <p/>
 	 * To create a different error, a new error builder has to be retrieved from
-	 * ConstraintValidatorContext
+	 * <code>ConstraintValidatorContext</code>
 	 *
 	 * Here are a few usage examples:
 	 * <pre>
@@ -74,7 +75,7 @@
 	 *              .addSubNode( "street" )
 	 *              .addError();
 	 *
-	 * //create new error in the "addresses["home"].city.name subnode of the default
+	 * //create new error in the "addresses["home"].city.name" subnode of the default
 	 * // path the constraint is located on
 	 * context.buildErrorWithMessageTemplate( "this detail is wrong" )
 	 *              .addSubNode( "addresses" )
@@ -98,8 +99,8 @@
 	 * the #addError method available in one of the
 	 * interfaces of the fluent API.
 	 * If another method is called after #addError() on
-	 * ErrorBuilder or any of its associated objects
-	 * an IllegalStateException is raised.
+	 * <code>ErrorBuilder</code> or any of its associated objects
+	 * an <code>IllegalStateException</code> is raised.
 	 * 
 	 */
 	interface ErrorBuilder {
@@ -116,11 +117,11 @@
 
 		/**
 		 * Add the new error report to be generated if the
-		 * constraint validator mark the value as invalid.
-		 * Methods of this ErrorBuilder instance and its nested
-		 * objects returns IllegalStateException from now on.
+		 * constraint validator marks the value as invalid.
+		 * Methods of this <code>ErrorBuilder</code> instance and its nested
+		 * objects returns <code>IllegalStateException</code> from now on.
 		 *
-		 * @return ConstraintValidatorContext instance the ErrorBuilder comes from 
+		 * @return the ConstraintValidatorContext instance the ErrorBuilder comes from
 		 */
 		ConstraintValidatorContext addError();
 
@@ -143,10 +144,10 @@
 
 			/**
 			 * Add the new error report to be generated if the
-			 * constraint validator mark the value as invalid.
-			 * Methods of the ErrorBuilder instance this object comes
+			 * constraint validator marks the value as invalid.
+			 * Methods of the <code>ErrorBuilder</code> instance this object comes
 			 * from and the error builder nested
-			 * objects returns IllegalStateException after this call.
+			 * objects returns <code>IllegalStateException</code> after this call.
 			 *
 			 * @return ConstraintValidatorContext instance the ErrorBuilder comes from
 			 */
@@ -160,7 +161,7 @@
 		interface NodeBuilderCustomizableContext {
 
 			/**
-			 * Mark the node as being in an Iterable or a Map
+			 * Mark the node as being in an <code>Iterable</code> or a <code>Map</code>
 			 * 
 			 * @return a builder representing iterable details
 			 */
@@ -180,9 +181,9 @@
 			/**
 			 * Add the new error report to be generated if the
 			 * constraint validator mark the value as invalid.
-			 * Methods of the ErrorBuilder instance this object comes
+			 * Methods of the <code>ErrorBuilder</code> instance this object comes
 			 * from and the error builder nested
-			 * objects returns IllegalStateException after this call.
+			 * objects returns <code>IllegalStateException</code> after this call.
 			 *
 			 * @return ConstraintValidatorContext instance the ErrorBuilder comes from
 			 */
@@ -191,14 +192,14 @@
 
 		/**
 		 * Represent refinement choices for a node which is
-		 * in an Iterator or Map.
+		 * in an <code>Iterator<code> or <code>Map</code>.
 		 * If the iterator is an indexed collection or a map,
 		 * the index or the key should be set.
 		 */
 		interface NodeContextBuilder {
 			
 			/**
-			 * Define the key the object is into the Map
+			 * Define the key the object is into the <code>Map</code>
 			 *
 			 * @param key map key
 			 * @return a builder representing the current node
@@ -206,7 +207,7 @@
 			NodeBuilderDefinedContext atKey(Object key);
 
 			/**
-			 * Define the index the object is into the List or array
+			 * Define the index the object is into the <code>List</code> or array
 			 *
 			 * @param index index
 			 * @return a builder representing the current node
@@ -227,9 +228,9 @@
 			/**
 			 * Add the new error report to be generated if the
 			 * constraint validator mark the value as invalid.
-			 * Methods of the ErrorBuilder instance this object comes
+			 * Methods of the <code>ErrorBuilder</code> instance this object comes
 			 * from and the error builder nested
-			 * objects returns IllegalStateException after this call.
+			 * objects returns <code>IllegalStateException</code> after this call.
 			 *
 			 * @return ConstraintValidatorContext instance the ErrorBuilder comes from
 			 */

Modified: beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorFactory.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorFactory.java	2009-09-29 16:34:58 UTC (rev 17578)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorFactory.java	2009-09-29 17:10:16 UTC (rev 17579)
@@ -18,7 +18,7 @@
 package javax.validation;
 
 /**
- * Instantiate a <code>ConstraintValidator</code> instance from its class.
+ * Instantiate a <code>ConstraintValidator</code> instance based off its class.
  * The <code>ConstraintValidatorFactory</code> is <b>not</b> responsible
  * for calling {@link ConstraintValidator#initialize(java.lang.annotation.Annotation)}.
  *

Modified: beanvalidation/api/trunk/src/main/java/javax/validation/OverridesAttribute.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/OverridesAttribute.java	2009-09-29 16:34:58 UTC (rev 17578)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/OverridesAttribute.java	2009-09-29 17:10:16 UTC (rev 17579)
@@ -40,7 +40,7 @@
 
 	/**
 	 * Name of the Constraint attribute overridden.
-	 * Defaults to the name of the attribute hosting OverridesAttribute.
+	 * Defaults to the name of the attribute hosting <code>@OverridesAttribute</code>.
 	 *
 	 * @return name of constraint attribute overridden.
 	 */
@@ -60,7 +60,7 @@
 
 	/**
 	 * Defines several @OverridesAttribute annotations on the same element
-	 * @see OverridesAttribute
+	 * @see javax.validation.OverridesAttribute
 	 */
 	@Documented
 	@Target({ METHOD })

Modified: beanvalidation/api/trunk/src/main/java/javax/validation/groups/Default.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/groups/Default.java	2009-09-29 16:34:58 UTC (rev 17578)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/groups/Default.java	2009-09-29 17:10:16 UTC (rev 17579)
@@ -1,3 +1,20 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.
+*/
 package javax.validation.groups;
 
 /**



More information about the hibernate-commits mailing list