[hibernate-commits] Hibernate SVN: r15875 - in validator/trunk: hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Feb 3 18:25:10 EST 2009


Author: epbernard
Date: 2009-02-03 18:25:10 -0500 (Tue, 03 Feb 2009)
New Revision: 15875

Added:
   validator/trunk/validation-api/src/main/java/javax/validation/ReportAsSingleViolation.java
Removed:
   validator/trunk/validation-api/src/main/java/javax/validation/ReportAsViolationFromCompositeConstraint.java
Modified:
   validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java
   validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java
   validator/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java
Log:
BVAL-112 rename @ReportAsViolationFromCompositeConstraint to @ReportAsSingleViolation

Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java	2009-02-03 21:38:56 UTC (rev 15874)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java	2009-02-03 23:25:10 UTC (rev 15875)
@@ -33,7 +33,7 @@
 import javax.validation.ConstraintValidator;
 import javax.validation.OverridesParameter;
 import javax.validation.OverridesParameters;
-import javax.validation.ReportAsViolationFromCompositeConstraint;
+import javax.validation.ReportAsSingleViolation;
 import javax.validation.ValidationException;
 import javax.validation.groups.Default;
 
@@ -112,7 +112,7 @@
 		this.builtinConstraints = builtinConstraints;
 
 		this.isReportAsSingleInvalidConstraint = annotation.annotationType().isAnnotationPresent(
-				ReportAsViolationFromCompositeConstraint.class
+				ReportAsSingleViolation.class
 		);
 
 
@@ -169,7 +169,7 @@
 	/**
 	 * {@inheritDoc}
 	 */
-	public boolean isReportAsViolationFromCompositeConstraint() {
+	public boolean isReportAsSingleViolation() {
 		return isReportAsSingleInvalidConstraint;
 	}
 

Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java	2009-02-03 21:38:56 UTC (rev 15874)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java	2009-02-03 23:25:10 UTC (rev 15875)
@@ -104,7 +104,7 @@
 
 	private boolean reportAsSingleViolation() {
 		return getParent() != null
-				&& getParent().getDescriptor().isReportAsViolationFromCompositeConstraint();
+				&& getParent().getDescriptor().isReportAsSingleViolation();
 	}
 
 	private <T> void createConstraintViolation(Object value, Class<T> beanClass, ValidationContext<T> validationContext, Object leafBeanInstance, String message, ConstraintDescriptor descriptor) {

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java	2009-02-03 21:38:56 UTC (rev 15874)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java	2009-02-03 23:25:10 UTC (rev 15875)
@@ -25,7 +25,7 @@
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import java.lang.annotation.Target;
 import javax.validation.Constraint;
-import javax.validation.ReportAsViolationFromCompositeConstraint;
+import javax.validation.ReportAsSingleViolation;
 
 /**
  * Constraint used to test nested composing constraints.
@@ -37,7 +37,7 @@
 @Documented
 @Target({ METHOD, FIELD, TYPE })
 @Retention(RUNTIME)
- at ReportAsViolationFromCompositeConstraint
+ at ReportAsSingleViolation
 public @interface GermanZipcode {
 	public abstract String message() default "Falsche Postnummer.";
 

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java	2009-02-03 21:38:56 UTC (rev 15874)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java	2009-02-03 23:25:10 UTC (rev 15875)
@@ -164,7 +164,7 @@
 		address.setAddressline2( "3ter Stock" );
 		address.setCity( "Karlsruhe" );
 		address.setZipCode( "abc" );
-		// actually three composing constraints fail, but due to @ReportAsViolationFromCompositeConstraint only one will be reported.
+		// actually three composing constraints fail, but due to @ReportAsSingleViolation only one will be reported.
 		Set<ConstraintViolation<GermanAddress>> constraintViolations = validator.validate( address );
 		assertNumberOfViolations( constraintViolations, 1 );
 		assertConstraintViolation(

Modified: validator/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java
===================================================================
--- validator/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java	2009-02-03 21:38:56 UTC (rev 15874)
+++ validator/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java	2009-02-03 23:25:10 UTC (rev 15875)
@@ -74,7 +74,7 @@
 	Set<ConstraintDescriptor> getComposingConstraints();
 
 	/**
-	 * @return true if the constraint is annotated with @ReportAsViolationFromCompositeConstraint
+	 * @return true if the constraint is annotated with @ReportAsSingleViolation
 	 */
-	boolean isReportAsViolationFromCompositeConstraint();
+	boolean isReportAsSingleViolation();
 }
\ No newline at end of file

Copied: validator/trunk/validation-api/src/main/java/javax/validation/ReportAsSingleViolation.java (from rev 15874, validator/trunk/validation-api/src/main/java/javax/validation/ReportAsViolationFromCompositeConstraint.java)
===================================================================
--- validator/trunk/validation-api/src/main/java/javax/validation/ReportAsSingleViolation.java	                        (rev 0)
+++ validator/trunk/validation-api/src/main/java/javax/validation/ReportAsSingleViolation.java	2009-02-03 23:25:10 UTC (rev 15875)
@@ -0,0 +1,35 @@
+// $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;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+
+/**
+ * A constraint annotation annotated with this annotation
+ * will return the composed annotation error report if any of the composing annotations
+ * fail. The error reports of each individual composing constraint is ignored.
+ *
+ * @author Emmanuel Bernard
+ */
+ at Target({ ANNOTATION_TYPE })
+ at Retention(RUNTIME)
+public @interface ReportAsSingleViolation {
+}


Property changes on: validator/trunk/validation-api/src/main/java/javax/validation/ReportAsSingleViolation.java
___________________________________________________________________
Name: svn:keywords
   + Id

Deleted: validator/trunk/validation-api/src/main/java/javax/validation/ReportAsViolationFromCompositeConstraint.java
===================================================================
--- validator/trunk/validation-api/src/main/java/javax/validation/ReportAsViolationFromCompositeConstraint.java	2009-02-03 21:38:56 UTC (rev 15874)
+++ validator/trunk/validation-api/src/main/java/javax/validation/ReportAsViolationFromCompositeConstraint.java	2009-02-03 23:25:10 UTC (rev 15875)
@@ -1,35 +0,0 @@
-// $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;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-
-/**
- * A constraint annotation annotated with this annotation
- * will return the composed annotation error report if any of the composing annotations
- * fail. The error reports of each individual composing constraint is ignored.
- *
- * @author Emmanuel Bernard
- */
- at Target({ ANNOTATION_TYPE })
- at Retention(RUNTIME)
-public @interface ReportAsViolationFromCompositeConstraint {
-}




More information about the hibernate-commits mailing list