Author: epbernard
Date: 2009-09-30 15:28:08 -0400 (Wed, 30 Sep 2009)
New Revision: 17596
Modified:
beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorContextImpl.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEndImpl.java
Log:
BVAL-186 Clarify method names on the constraint violation builder DSL of
ConstraintValidatorContext
Modified:
beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java
===================================================================
---
beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java 2009-09-30
19:24:02 UTC (rev 17595)
+++
beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintValidatorContext.java 2009-09-30
19:28:08 UTC (rev 17596)
@@ -27,8 +27,8 @@
*/
public interface ConstraintValidatorContext {
/**
- * Disable the default <code>ConstraintViolation</code> object generation
using the
- * declared message template.
+ * Disable the default <code>ConstraintViolation</code> object generation
(which
+ * is using the message template declared on the constraint).
* Useful to set a different violation message or generate a
<code>ConstraintViolation</Code>
* based on a different property.
*/
@@ -66,18 +66,18 @@
* <pre>
* {@code
* // create new violation report with the default path the constraint is located on
- * context.buildConstraintViolationWithMessageTemplate( "way too long" )
+ * context.buildConstraintViolationWithTemplate( "way too long" )
* .addConstraintViolation();
*
* // create new violation report in the "street" subnode of the default path
* //the constraint is located on
- * context.buildConstraintViolationWithMessageTemplate( "way too long" )
+ * context.buildConstraintViolationWithTemplate( "way too long" )
* .addNode( "street" )
* .addConstraintViolation();
*
* //create new violation report in the
"addresses["home"].city.name" subnode
* //of the default path the constraint is located on
- * context.buildConstraintViolationWithMessageTemplate( "this detail is wrong"
)
+ * context.buildConstraintViolationWithTemplate( "this detail is wrong" )
* .addNode( "addresses" )
* .addNode( "country" )
* .inIterable().atKey( "home" )
@@ -89,7 +89,7 @@
* @param messageTemplate new uninterpolated constraint message.
* @return Returns an constraint violation builder
*/
- ConstraintViolationBuilder buildConstraintViolationWithMessageTemplate(String
messageTemplate);
+ ConstraintViolationBuilder buildConstraintViolationWithTemplate(String
messageTemplate);
/**
* <code>ConstraintViolation</code> builder allowing to optionally
associate
Modified:
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java
===================================================================
---
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java 2009-09-30
19:24:02 UTC (rev 17595)
+++
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java 2009-09-30
19:28:08 UTC (rev 17596)
@@ -34,7 +34,7 @@
}
if ( "00000".equals( zip ) ) {
constraintValidatorContext.disableDefaultConstraintViolation();
- constraintValidatorContext.buildConstraintViolationWithMessageTemplate( "00000 is
a reserved code" ).addConstraintViolation();
+ constraintValidatorContext.buildConstraintViolationWithTemplate( "00000 is a
reserved code" ).addConstraintViolation();
return false;
}
else {
Modified:
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java
===================================================================
---
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java 2009-09-30
19:24:02 UTC (rev 17595)
+++
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java 2009-09-30
19:28:08 UTC (rev 17596)
@@ -42,10 +42,10 @@
if ( errorMessages != null ) {
for ( Map.Entry<String, String> entry : errorMessages.entrySet() ) {
if ( entry.getKey() == null ) {
- constraintValidatorContext.buildConstraintViolationWithMessageTemplate(
entry.getValue() ).addConstraintViolation();
+ constraintValidatorContext.buildConstraintViolationWithTemplate( entry.getValue()
).addConstraintViolation();
}
else {
- constraintValidatorContext.buildConstraintViolationWithMessageTemplate(
entry.getValue() )
+ constraintValidatorContext.buildConstraintViolationWithTemplate( entry.getValue() )
.addNode( entry.getKey() )
.addConstraintViolation();
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorContextImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorContextImpl.java 2009-09-30
19:24:02 UTC (rev 17595)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintValidatorContextImpl.java 2009-09-30
19:28:08 UTC (rev 17596)
@@ -48,7 +48,7 @@
return ( String ) constraintDescriptor.getAttributes().get( "message" );
}
- public ConstraintViolationBuilder buildConstraintViolationWithMessageTemplate(String
messageTemplate) {
+ public ConstraintViolationBuilder buildConstraintViolationWithTemplate(String
messageTemplate) {
return new ErrorBuilderImpl( messageTemplate, propertyPath );
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEndImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEndImpl.java 2009-09-30
19:24:02 UTC (rev 17595)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/StartLessThanEndImpl.java 2009-09-30
19:28:08 UTC (rev 17596)
@@ -31,7 +31,7 @@
public boolean isValid(Interval value, ConstraintValidatorContext c) {
if ( value.start > value.end ) {
c.disableDefaultConstraintViolation();
- c.buildConstraintViolationWithMessageTemplate( c.getDefaultConstraintMessageTemplate()
).addNode( "start" ).addConstraintViolation();
+ c.buildConstraintViolationWithTemplate( c.getDefaultConstraintMessageTemplate()
).addNode( "start" ).addConstraintViolation();
return false;
}
return true;
Show replies by date