Author: epbernard
Date: 2009-05-05 08:36:30 -0400 (Tue, 05 May 2009)
New Revision: 16509
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/TraversableResolver.java
Log:
BVAL-152 TraversableResolver should differentiate reachability and cascadability
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/TraversableResolver.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/TraversableResolver.java 2009-05-05
10:12:04 UTC (rev 16508)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/TraversableResolver.java 2009-05-05
12:36:30 UTC (rev 16509)
@@ -21,7 +21,7 @@
/**
* Contract determining if a property can be accessed by the Bean Validation provider
- * This contract is called for each property either validated or traversed.
+ * This contract is called for each property either validated or cascaded.
*
* A traversable resolver implementation must be thread-safe.
*
@@ -29,7 +29,7 @@
*/
public interface TraversableResolver {
/**
- * Determine if a property can be traversed by Bean Validation.
+ * Determine if Bean Validation is allowed to reach the property state
*
* @param traversableObject object hosting <code>traversableProperty</code>,
null if validateValue is called
* @param traversableProperty name of the traversable property.
@@ -40,12 +40,37 @@
* (using the path specification defined by Bean Validator).
* @param elementType either <code>FIELD</code> or
<code>METHOD</code>.
*
- * @return <code>true</code> if the property is traversable by Bean
Validation,
+ * @return <code>true</code> if Bean Validation is allowed to reach the
property state,
* <code>false</code> otherwise.
*/
- boolean isTraversable(Object traversableObject,
+ boolean isReachable(Object traversableObject,
String traversableProperty,
Class<?> rootBeanType,
String pathToTraversableObject,
ElementType elementType);
+
+ /**
+ * Determine if Bean Validation is allowed to cascade validation on
+ * the bean instance returned by the property value
+ * marked as <code>@Valid</code>.
+ * Note that this method is called only if isReachable returns true for the same set of
+ * arguments and if the property is marked as <code>@Valid</code>
+ *
+ * @param traversableObject object hosting <code>traversableProperty</code>,
null if validateValue is called
+ * @param traversableProperty name of the traversable property.
+ * @param rootBeanType type of the root object passed to the Validator.
+ * @param pathToTraversableObject path from the root object to
+ * <code>traversableObject</code> ("" if the
<code>traversableObject</code>
+ * is the root object)
+ * (using the path specification defined by Bean Validator).
+ * @param elementType either <code>FIELD</code> or
<code>METHOD</code>.
+ *
+ * @return <code>true</code> if Bean Validation is allowed to cascade
validation,
+ * <code>false</code> otherwise.
+ */
+ boolean isCascadable(Object traversableObject,
+ String traversableProperty,
+ Class<?> rootBeanType,
+ String pathToTraversableObject,
+ ElementType elementType);
}
Show replies by date