Hibernate SVN: r16169 - core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2009-03-17 15:04:10 -0400 (Tue, 17 Mar 2009)
New Revision: 16169
Modified:
core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java
Log:
Clean up compiler warns
Modified: core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java
===================================================================
--- core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java 2009-03-17 13:23:54 UTC (rev 16168)
+++ core/trunk/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/CacheTestCaseBase.java 2009-03-17 19:04:10 UTC (rev 16169)
@@ -23,7 +23,6 @@
*/
package org.hibernate.test.cache.jbc2.functional;
-import org.hibernate.cache.RegionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Mappings;
@@ -73,7 +72,7 @@
cfg.setProperty(Environment.CONNECTION_PROVIDER, getConnectionProviderClass().getName());
cfg.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, getTransactionManagerLookupClass().getName());
- Class transactionFactory = getTransactionFactoryClass();
+ Class<?> transactionFactory = getTransactionFactoryClass();
if (transactionFactory != null)
cfg.setProperty( Environment.TRANSACTION_STRATEGY, transactionFactory.getName() );
@@ -101,19 +100,19 @@
*/
protected abstract void configureCacheFactory(Configuration cfg);
- protected abstract Class getCacheRegionFactory();
+ protected abstract Class<?> getCacheRegionFactory();
protected abstract boolean getUseQueryCache();
- protected Class getConnectionProviderClass() {
+ protected Class<?> getConnectionProviderClass() {
return org.hibernate.test.tm.ConnectionProviderImpl.class;
}
- protected Class getTransactionManagerLookupClass() {
+ protected Class<?> getTransactionManagerLookupClass() {
return org.hibernate.test.tm.TransactionManagerLookupImpl.class;
}
- protected Class getTransactionFactoryClass() {
+ protected Class<?> getTransactionFactoryClass() {
return null;
}
17 years, 1 month
Hibernate SVN: r16168 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-03-17 09:23:54 -0400 (Tue, 17 Mar 2009)
New Revision: 16168
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
Log:
HV-126 fixed bug when a cascaded value is null
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-03-17 13:00:53 UTC (rev 16167)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-03-17 13:23:54 UTC (rev 16168)
@@ -265,7 +265,7 @@
for ( MetaConstraint<T, ?> metaConstraint : beanMetaData.geMetaConstraintList() ) {
executionContext.pushProperty( metaConstraint.getPropertyName() );
if ( executionContext.isValidationRequired( metaConstraint ) ) {
- boolean tmp = metaConstraint.validateConstraint( executionContext );
+ boolean tmp = metaConstraint.validateConstraint( executionContext );
validationSuccessful = validationSuccessful && tmp;
}
executionContext.popProperty();
@@ -281,11 +281,10 @@
Type type = ReflectionHelper.typeOf( member );
context.pushProperty( ReflectionHelper.getPropertyName( member ) );
Object value = ReflectionHelper.getValue( member, context.peekCurrentBean() );
- if ( value == null ) {
- continue;
+ if ( value != null ) {
+ Iterator<?> iter = createIteratorForCascadedValue( context, type, value );
+ validateCascadedConstraint( context, iter );
}
- Iterator<?> iter = createIteratorForCascadedValue( context, type, value );
- validateCascadedConstraint( context, iter );
context.popProperty();
}
}
@@ -445,7 +444,6 @@
while ( groupIterator.hasNext() ) {
Group group = groupIterator.next();
validateValueForGroup(
- beanType,
value,
propertyIter,
failingConstraintViolations,
@@ -461,7 +459,6 @@
int numberOfConstraintViolations = failingConstraintViolations.size();
for ( Group group : sequence ) {
validateValueForGroup(
- beanType,
value,
propertyIter,
failingConstraintViolations,
@@ -476,7 +473,7 @@
}
}
- private <T> void validateValueForGroup(Class<T> beanType, Object value, PropertyIterator propertyIter, List<ConstraintViolationImpl<T>> failingConstraintViolations, Set<MetaConstraint<T, ?>> metaConstraints, Group group) {
+ private <T> void validateValueForGroup(Object value, PropertyIterator propertyIter, List<ConstraintViolationImpl<T>> failingConstraintViolations, Set<MetaConstraint<T, ?>> metaConstraints, Group group) {
int numberOfConstraintViolations = failingConstraintViolations.size();
BeanMetaData<T> beanMetaData = getBeanMetaData( metaConstraints.iterator().next().getBeanClass() );
17 years, 1 month
Hibernate SVN: r16167 - validator/trunk/hibernate-validator/src/test/resources.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-03-17 09:00:53 -0400 (Tue, 17 Mar 2009)
New Revision: 16167
Modified:
validator/trunk/hibernate-validator/src/test/resources/log4j.properties
Log:
Modified: validator/trunk/hibernate-validator/src/test/resources/log4j.properties
===================================================================
--- validator/trunk/hibernate-validator/src/test/resources/log4j.properties 2009-03-17 12:58:56 UTC (rev 16166)
+++ validator/trunk/hibernate-validator/src/test/resources/log4j.properties 2009-03-17 13:00:53 UTC (rev 16167)
@@ -18,7 +18,7 @@
### set log levels - for more verbose logging change 'info' to 'debug' ###
-log4j.rootLogger=debug, stdout, socket
+log4j.rootLogger=debug, stdout
log4j.logger.org.hibernate.validation.engine.ValidatorImpl=trace
log4j.logger.org.hibernate.validation.engine.ConstraintTree=trace
17 years, 1 month
Hibernate SVN: r16166 - validator/trunk/hibernate-validator and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-03-17 08:58:56 -0400 (Tue, 17 Mar 2009)
New Revision: 16166
Modified:
beanvalidation/trunk/validation-api/pom.xml
validator/trunk/hibernate-validator/pom.xml
Log:
changed pom version for BV API
Modified: beanvalidation/trunk/validation-api/pom.xml
===================================================================
--- beanvalidation/trunk/validation-api/pom.xml 2009-03-17 03:42:25 UTC (rev 16165)
+++ beanvalidation/trunk/validation-api/pom.xml 2009-03-17 12:58:56 UTC (rev 16166)
@@ -6,7 +6,7 @@
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.Beta4</version>
+ <version>1.0.CR1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Bean Validation API</name>
Modified: validator/trunk/hibernate-validator/pom.xml
===================================================================
--- validator/trunk/hibernate-validator/pom.xml 2009-03-17 03:42:25 UTC (rev 16165)
+++ validator/trunk/hibernate-validator/pom.xml 2009-03-17 12:58:56 UTC (rev 16166)
@@ -22,7 +22,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.Beta4</version>
+ <version>1.0.CR1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
17 years, 1 month
Hibernate SVN: r16165 - beanvalidation/tags.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-03-16 23:42:25 -0400 (Mon, 16 Mar 2009)
New Revision: 16165
Added:
beanvalidation/tags/v1_0_CR1/
Log:
CR1 Proposed final draft
Copied: beanvalidation/tags/v1_0_CR1 (from rev 16164, beanvalidation/trunk)
17 years, 1 month
Hibernate SVN: r16164 - in beanvalidation/trunk/validation-api/src/main/java/javax/validation: constraints and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-03-16 23:15:16 -0400 (Mon, 16 Mar 2009)
New Revision: 16164
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Digits.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Future.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Past.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java
Log:
minor JavaDoc adjustments
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java 2009-03-16 23:50:05 UTC (rev 16163)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java 2009-03-17 03:15:16 UTC (rev 16164)
@@ -33,7 +33,8 @@
* @param message error message
* @param constraintViolations Set of ConstraintViolation
*/
- public ConstraintViolationException(String message, Set<ConstraintViolation> constraintViolations) {
+ public ConstraintViolationException(String message,
+ Set<ConstraintViolation> constraintViolations) {
super( message );
this.constraintViolations = constraintViolations;
}
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Digits.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Digits.java 2009-03-16 23:50:05 UTC (rev 16163)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Digits.java 2009-03-17 03:15:16 UTC (rev 16164)
@@ -31,11 +31,9 @@
* <ul>
* <li><code>BigDecimal</code></li>
* <li><code>BigInteger</code></li>
- * <li><code>Number</code></li>
* <li><code>String</code></li>
- * <li><code>byte</code>, <code>short</code>, <code>int</code>,
- * <code>long</code>, <code>float</code>,
- * <code>double</code></li>
+ * <li><code>byte</code>, <code>short</code>, <code>int</code>, <code>long</code>,
+ * and their respective wrapper types</li>
* </ul>
* <p/>
* <code>null</code> elements are considered valid
@@ -63,7 +61,7 @@
/**
* Defines several @Digits annotations on the same element
- * @see Digits
+ * @see {@link Digits}
*
* @author Emmanuel Bernard
*/
@@ -71,6 +69,6 @@
@Retention(RUNTIME)
@Documented
@interface List {
- Size[] value();
+ Digits[] value();
}
}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Future.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Future.java 2009-03-16 23:50:05 UTC (rev 16163)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Future.java 2009-03-17 03:15:16 UTC (rev 16164)
@@ -31,14 +31,11 @@
* The calendar used if the compared type is of type <code>Calendar</code>
* is the calendar based on the current timezone and the current locale.
* <p/>
- * TODO what are the implications
- * <p/>
* Supported types are:
* <ul>
* <li><code>java.util.Date</code></li>
* <li><code>java.util.Calendar</code></li>
* </ul>
- * - TODO new date/time JSR types?
* <p/>
* <code>null</code> elements are considered valid.
*
@@ -54,7 +51,7 @@
/**
* Defines several @Future annotations on the same element
- * @see javax.validation.constraints.Future
+ * @see {@link Future}
*
* @author Emmanuel Bernard
*/
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Past.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Past.java 2009-03-16 23:50:05 UTC (rev 16163)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Past.java 2009-03-17 03:15:16 UTC (rev 16164)
@@ -31,14 +31,11 @@
* The calendar used if the compared type is of type <code>Calendar</code>
* is the calendar based on the current timezone and the current locale.
* <p/>
- * TODO what are the implications
- * <p/>
* Supported types are:
* <ul>
* <li><code>java.util.Date</code></li>
* <li><code>java.util.Calendar</code></li>
* </ul>
- * - TODO new date/time JSR types?
* <p/>
* <code>null</code> elements are considered valid.
*
@@ -53,8 +50,8 @@
Class<?>[] groups() default { };
/**
- * Defines several @NotNull annotations on the same element
- * @see Past
+ * Defines several @Past annotations on the same element
+ * @see {@link Past}
*
* @author Emmanuel Bernard
*/
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java 2009-03-16 23:50:05 UTC (rev 16163)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java 2009-03-17 03:15:16 UTC (rev 16164)
@@ -13,7 +13,7 @@
* The regular expression follows the Java regular expression conventions
* see {@link java.util.regex.Pattern}.
*
- * Accepts String.
+ * Accepts String. <code>null</code> elements are considered valid.
*
* @author Emmanuel Bernard
*/
@@ -85,12 +85,12 @@
* Enables canonical equivalence
* @see java.util.regex.Pattern#CANON_EQ
*/
- CANON_EQ,
+ CANON_EQ
}
/**
* Defines several @Pattern annotations on the same element
- * @see javax.validation.constraints.Pattern
+ * @see @link Pattern}
*
* @author Emmanuel Bernard
*/
17 years, 1 month
Hibernate SVN: r16163 - beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-03-16 19:50:05 -0400 (Mon, 16 Mar 2009)
New Revision: 16163
Added:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Max.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Min.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Size.java
Log:
BVAL-142 Min/@max no longer accept float/double and introduce @DecimalMin/@DecimalMax
Copied: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java (from rev 16160, beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Max.java)
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java (rev 0)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMax.java 2009-03-16 23:50:05 UTC (rev 16163)
@@ -0,0 +1,74 @@
+// $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.constraints;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated element must be a number whose value must be lower or
+ * equal to the specified maximum.
+ * <p/>
+ * Supported types are:
+ * <ul>
+ * <li><code>BigDecimal</code></li>
+ * <li><code>BigInteger</code></li>
+ * <li><code>String</code></li>
+ * <li><code>byte</code>, <code>short</code>, <code>int</code>, <code>long</code>,
+ * and their respective wrappers</li>
+ * </ul>
+ * Note that <code>double</code> and <code>float</code> are not supported due to rounding errors
+ * (some providers might provide some approximative support)
+ * <p/>
+ * <code>null</code> elements are considered valid
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ METHOD, FIELD, ANNOTATION_TYPE })
+@Retention(RUNTIME)
+@Documented
+public @interface DecimalMax {
+ String message() default "{constraint.decimalmax}";
+
+ Class<?>[] groups() default { };
+
+ /**
+ * The String representation of the max value according to the
+ * BigDecimal string representation
+ * @return value the element must be lower or equal to
+ */
+ String value();
+
+ /**
+ * Defines several @DecimalMax annotations on the same element
+ * @see {@link DecimalMax}
+ *
+ * @author Emmanuel Bernard
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ @Retention(RUNTIME)
+ @Documented
+ @interface List {
+ DecimalMax[] value();
+ }
+}
\ No newline at end of file
Added: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java (rev 0)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java 2009-03-16 23:50:05 UTC (rev 16163)
@@ -0,0 +1,74 @@
+// $Id: Max.java 16152 2009-03-12 21:33:48Z epbernard $
+/*
+* 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.constraints;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * The annotated element must be a number whose value must be higher or
+ * equal to the specificed minimum.
+ * <p/>
+ * Supported types are:
+ * <ul>
+ * <li><code>BigDecimal</code></li>
+ * <li><code>BigInteger</code></li>
+ * <li><code>String</code></li>
+ * <li><code>byte</code>, <code>short</code>, <code>int</code>, <code>long</code>,
+ * and their respective wrappers</li>
+ * </ul>
+ * Note that <code>double</code> and <code>float</code> are not supported due to rounding errors
+ * (some providers might provide some approximative support)
+ * <p/>
+ * <code>null</code> elements are considered valid
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ METHOD, FIELD, ANNOTATION_TYPE })
+@Retention(RUNTIME)
+@Documented
+public @interface DecimalMin {
+ String message() default "{constraint.decimalmin}";
+
+ Class<?>[] groups() default { };
+
+ /**
+ * The String representation of the min value according to the
+ * BigDecimal string representation
+ * @return value the element must be higher or equal to
+ */
+ String value();
+
+ /**
+ * Defines several @DecimalMin annotations on the same element
+ * @see {@link DecimalMin}
+ *
+ * @author Emmanuel Bernard
+ */
+ @Target({ METHOD, FIELD, ANNOTATION_TYPE })
+ @Retention(RUNTIME)
+ @Documented
+ @interface List {
+ DecimalMin[] value();
+ }
+}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Max.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Max.java 2009-03-16 23:34:13 UTC (rev 16162)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Max.java 2009-03-16 23:50:05 UTC (rev 16163)
@@ -27,22 +27,21 @@
/**
* The annotated element must be a number whose value must be lower or
- * equal than the specificed maximum.
+ * equal to the specified maximum.
* <p/>
* Supported types are:
* <ul>
* <li><code>BigDecimal</code></li>
* <li><code>BigInteger</code></li>
- * <li><code>Number</code></li>
- * <li><code>String</code></li>
* <li><code>byte</code>, <code>short</code>, <code>int</code>, <code>long</code>,
- * <code>float</code>, <code>double</code></li>
+ * and their respective wrappers</li>
* </ul>
+ * Note that <code>double</code> and <code>float</code> are not supported due to rounding errors
+ * (some providers might provide some approximative support)
* <p/>
* <code>null</code> elements are considered valid
*
* @author Emmanuel Bernard
- * @todo Is string supported or not?
*/
@Target({ METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@@ -53,13 +52,13 @@
Class<?>[] groups() default { };
/**
- * @return Value the element must be lower or equal to
+ * @return value the element must be lower or equal to
*/
long value();
/**
* Defines several @Max annotations on the same element
- * @see Max
+ * @see {@link Max}
*
* @author Emmanuel Bernard
*/
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Min.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Min.java 2009-03-16 23:34:13 UTC (rev 16162)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Min.java 2009-03-16 23:50:05 UTC (rev 16163)
@@ -26,23 +26,22 @@
import java.lang.annotation.Target;
/**
- * The annotated element must be a number whose value must be greater or
- * equal than the specificed minimum
+ * The annotated element must be a number whose value must be higher or
+ * equal to the specified minimum.
* <p/>
* Supported types are:
* <ul>
* <li><code>BigDecimal</code></li>
* <li><code>BigInteger</code></li>
- * <li><code>Number</code></li>
- * <li><code>String</code></li>
* <li><code>byte</code>, <code>short</code>, <code>int</code>, <code>long</code>,
- * <code>float</code>, <code>double</code></li>
+ * and their respective wrappers</li>
* </ul>
+ * Note that <code>double</code> and <code>float</code> are not supported due to rounding errors
+ * (some providers might provide some approximative support)
* <p/>
* <code>null</code> elements are considered valid
*
* @author Emmanuel Bernard
- * @todo Is string supported or not?
*/
@Target({ METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@@ -53,13 +52,13 @@
Class<?>[] groups() default { };
/**
- * @return Value the element must be higher or equal to
+ * @return value the element must be higher or equal to
*/
long value();
/**
* Defines several @Min annotations on the same element
- * @see javax.validation.constraints.Min
+ * @see {@link Min}
*
* @author Emmanuel Bernard
*/
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Size.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Size.java 2009-03-16 23:34:13 UTC (rev 16162)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Size.java 2009-03-16 23:50:05 UTC (rev 16163)
@@ -33,7 +33,7 @@
* <li><code>String</code> (string length is evaludated)</li>
* <li><code>Collection</code> (collection size is evaluated)</li>
* <li><code>Map</code> (map size is evaluated)</li>
- * <li>Array (array length is evaludated)</li>
+ * <li>Array (array length is evaluated)</li>
*
* <code>null</code> elements are considered valid.
*
@@ -58,7 +58,7 @@
/**
* Defines several @Size annotations on the same element
- * @see Size
+ * @see {@link Size}
*
* @author Emmanuel Bernard
*/
17 years, 1 month
Hibernate SVN: r16162 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-03-16 19:34:13 -0400 (Mon, 16 Mar 2009)
New Revision: 16162
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java
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/main/java/org/hibernate/validation/engine/ExecutionContext.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java
Log:
BVAL-141 Rename ConstraintDescriptor.getParameters() to getAttributes()
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java 2009-03-16 23:26:39 UTC (rev 16161)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java 2009-03-16 23:34:13 UTC (rev 16162)
@@ -32,8 +32,8 @@
public interface ConstraintDescriptor<T extends Annotation> {
/**
* Returns the annotation describing the constraint declaration.
- * If a composing constraint, parameter values are reflecting
- * the overridden parameters from the main constraint
+ * If a composing constraint, attribute values are reflecting
+ * the overridden attributes from the composing constraint
*
* @return The annotation for this constraint.
*/
@@ -54,24 +54,24 @@
* @return list of the constraint validation implementation classes.
*/
List<Class<? extends ConstraintValidator<T, ?>>>
- getConstraintValidatorClasses();
+ getConstraintValidatorClasses();
/**
- * Returns a map containing the annotation parameter names as keys and the
- * annotation parameter values as value.
- * If this constraint is used as part of a composed constraint, parameter
- * values are reflecting the overridden parameters from the main constraint.
+ * Returns a map containing the annotation attribute names as keys and the
+ * annotation attribute values as value.
+ * If this constraint is used as part of a composed constraint, attribute
+ * values are reflecting the overridden attribute from the composing constraint.
*
- * @return a map containing the annotation paramter names as keys
- * and the annotation parameter values as value.
+ * @return a map containing the annotation attribute names as keys
+ * and the annotation attribute values as value.
*/
- Map<String, Object> getParameters();
+ Map<String, Object> getAttributes();
/**
* Return a set of composing <code>ConstraintDescriptor</code>s where each
* descriptor describes a composing constraint. <code>ConstraintDescriptor</code>
- * instances of composing constraints reflect overridden parameter values in
- * {@link #getParameters()} and {@link #getAnnotation()}.
+ * instances of composing constraints reflect overridden attribute values in
+ * {@link #getAttributes()} and {@link #getAnnotation()}.
*
* @return a set of <code>ConstraintDescriptor<code> objects or an empty set
* in case there are no composing constraints.
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java 2009-03-16 23:26:39 UTC (rev 16161)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java 2009-03-16 23:34:13 UTC (rev 16162)
@@ -3,7 +3,7 @@
/**
* Describes a Java Bean property hosting validation constraints.
*
- * Constraints placed on the attribute and the getter for a given property
+ * Constraints placed on the attribute and the getter of a given property
* are all referenced by this object.
*
* @author Emmanuel Bernard
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-03-16 23:26:39 UTC (rev 16161)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java 2009-03-16 23:34:13 UTC (rev 16162)
@@ -73,7 +73,7 @@
* The constraint parameters as map. The key is the paramter name and the value the
* parameter value as specified in the constraint.
*/
- private final Map<String, Object> parameters;
+ private final Map<String, Object> attributes;
/**
* The composing constraints for this constraints.
@@ -106,7 +106,7 @@
private ConstraintDescriptorImpl(T annotation, Set<Class<?>> groups, ConstraintHelper constraintHelper) {
this.annotation = annotation;
this.groups = groups;
- this.parameters = getAnnotationParameters( annotation );
+ this.attributes = getAnnotationParameters( annotation );
this.constraintHelper = constraintHelper;
this.isReportAsSingleInvalidConstraint = annotation.annotationType().isAnnotationPresent(
@@ -161,8 +161,8 @@
/**
* {@inheritDoc}
*/
- public Map<String, Object> getParameters() {
- return Collections.unmodifiableMap( parameters );
+ public Map<String, Object> getAttributes() {
+ return Collections.unmodifiableMap( attributes );
}
/**
@@ -185,7 +185,7 @@
"annotation=" + annotation +
", constraintValidatorDefinitonClasses=" + constraintValidatorDefinitonClasses.toString() +
", groups=" + groups +
- ", parameters=" + parameters +
+ ", attributes=" + attributes +
", composingConstraints=" + composingConstraints +
", isReportAsSingleInvalidConstraint=" + isReportAsSingleInvalidConstraint +
'}';
@@ -199,10 +199,10 @@
parameters.put( m.getName(), m.invoke( annotation ) );
}
catch ( IllegalAccessException e ) {
- throw new ValidationException( "Unable to read annotation parameters: " + annotation.getClass(), e );
+ throw new ValidationException( "Unable to read annotation attributes: " + annotation.getClass(), e );
}
catch ( InvocationTargetException e ) {
- throw new ValidationException( "Unable to read annotation parameters: " + annotation.getClass(), e );
+ throw new ValidationException( "Unable to read annotation attributes: " + annotation.getClass(), e );
}
}
return Collections.unmodifiableMap( parameters );
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-03-16 23:26:39 UTC (rev 16161)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java 2009-03-16 23:34:13 UTC (rev 16162)
@@ -118,7 +118,7 @@
}
if ( reportAsSingleViolation() && constraintViolations.size() > 0 ) {
constraintViolations.clear();
- final String message = ( String ) getParent().getDescriptor().getParameters().get( "message" );
+ final String message = ( String ) getParent().getDescriptor().getAttributes().get( "message" );
final String property = executionContext.peekPropertyPath();
ExecutionContext<T>.ErrorMessage error = executionContext.new ErrorMessage( message, property );
constraintViolations.add( executionContext.createConstraintViolation( value, error ) );
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-03-16 23:26:39 UTC (rev 16161)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-03-16 23:34:13 UTC (rev 16162)
@@ -328,7 +328,7 @@
}
public String getDefaultErrorMessage() {
- return ( String ) constraintDescriptor.getParameters().get( "message" );
+ return ( String ) constraintDescriptor.getAttributes().get( "message" );
}
public void addError(String message) {
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java 2009-03-16 23:26:39 UTC (rev 16161)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java 2009-03-16 23:34:13 UTC (rev 16162)
@@ -89,14 +89,14 @@
public String interpolate(String message, Context context) {
// probably no need for caching, but it could be done by parameters since the map
// is immutable and uniquely built per Validation definition, the comparaison has to be based on == and not equals though
- return interpolateMessage( message, context.getConstraintDescriptor().getParameters(), defaultLocale );
+ return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(), defaultLocale );
}
/**
* {@inheritDoc}
*/
public String interpolate(String message, Context context, Locale locale) {
- return interpolateMessage( message, context.getConstraintDescriptor().getParameters(), locale );
+ return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(), locale );
}
/**
17 years, 1 month
Hibernate SVN: r16161 - beanvalidation/trunk/validation-api/src/main/java/javax/validation/bootstrap and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-03-16 19:26:39 -0400 (Mon, 16 Mar 2009)
New Revision: 16161
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/BeanDescriptor.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/Configuration.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupSequence.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/MessageInterpolator.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validation.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validator.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ValidatorFactory.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ConfigurationState.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ValidationProvider.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanDescriptorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java
Log:
BVAL-140 BeanDescriptor.getConstrainedProperties() returns Set<PropertyDescriptor>, various typos and enhancements
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/BeanDescriptor.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/BeanDescriptor.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/BeanDescriptor.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -52,8 +52,8 @@
PropertyDescriptor getConstraintsForProperty(String propertyName);
/**
- * @return the property names having at least one constraint defined or which are marked
+ * @return the property descriptors having at least one constraint defined or which are marked
* as cascaded (@Valid) or an empty set.
*/
- Set<String> getConstrainedProperties();
+ Set<PropertyDescriptor> getConstrainedProperties();
}
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/Configuration.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/Configuration.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/Configuration.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -21,7 +21,7 @@
/**
* Receives configuration information, selects the appropriate
- * Bean Validation provider and build the appropriate
+ * Bean Validation provider and builds the appropriate
* ValidatorFactory.
* <p/>
* Usage:
@@ -69,9 +69,8 @@
/**
* Defines the message interpolator used. Has priority over the configuration
* based message interpolator.
- * If null is passed, the default message interpolator
- * (defined in XML or the specification default)
- * is used.
+ * If null is passed, the default message interpolator is used
+ * (defined in XML or the specification default).
*
* @param interpolator message interpolator implementation.
*
@@ -82,9 +81,8 @@
/**
* Defines the traversable resolver used. Has priority over the configuration
* based traversable resolver.
- * If null is passed, the default traversable resolver
- * (defined in XML or the specification default)
- * is used.
+ * If null is passed, the default traversable resolver is used
+ * (defined in XML or the specification default).
*
* @param resolver traversable resolver implementation.
*
@@ -95,9 +93,8 @@
/**
* Defines the constraint validator factory. Has priority over the configuration
* based constraint factory.
- * If null is passed, the default constraint validator factory
- * (defined in XML or the specification default)
- * is used.
+ * If null is passed, the default constraint validator factory is used
+ * (defined in XML or the specification default).
*
* @param constraintValidatorFactory constraint factory inmplementation.
*
@@ -122,14 +119,14 @@
/**
* Add a provider specific property. This property is equivalent to
- * XML Configuration properties.
+ * XML configuration properties.
* If the underlying provider does not know how to handle the property,
* it must silently ignore it.
* <p/>
* Note: Using this non type-safe method is generally not recommended.
* <p/>
* It is more appropriate to use, if available, the type-safe equivalent provided
- * by a specific provider in its Configuration subclass.
+ * by a specific provider via its Configuration subclass.
* <code>ValidatorFactory factory = Validation.byProvider(ACMEConfiguration.class)
* .configure()
* .providerSpecificProperty(ACMEState.FAST)
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolation.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -24,8 +24,6 @@
* well as the message describing the violation.
*
* @author Emmanuel Bernard
- * @todo the rational behind rootBean and propertyPath is to keep the context
- * available to the user
*/
public interface ConstraintViolation<T> {
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupSequence.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupSequence.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupSequence.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -24,7 +24,9 @@
/**
* Define a group sequence
- * Should be hosted by an
+ * The interface hosting @GroupSequence is representing the group sequence.
+ * When hosted on a class, represents the <code>Default</code> group
+ * for that class.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/MessageInterpolator.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/MessageInterpolator.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/MessageInterpolator.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -28,21 +28,22 @@
*/
public interface MessageInterpolator {
/**
- * Interpolate the message from the constraint parameters and the actual validated object.
- * The locale is defaulted according to the <code>MessageInterpolator</code> implementation
- * See the implementation documentation for more detail.
+ * Interpolate the message from the constraint parameters and the actual validated
+ * object.
+ * The locale is defaulted according to the <code>MessageInterpolator</code>
+ * implementation. See the implementation documentation for more detail.
*
* @param messageTemplate The message to interpolate.
* @param context contextual information related to the interpolation
*
* @return Interpolated error message.
*/
- String interpolate(String messageTemplate,
- Context context);
+ String interpolate(String messageTemplate, Context context);
/**
- * Interpolate the message from the constraint parameters and the actual validated object.
- * The Locale used is provided as a parameter
+ * Interpolate the message from the constraint parameters and the actual validated
+ * object.
+ * The Locale used is provided as a parameter.
*
* @param messageTemplate The message to interpolate.
* @param context contextual information related to the interpolation
@@ -50,9 +51,7 @@
*
* @return Interpolated error message.
*/
- String interpolate(String messageTemplate,
- Context context,
- Locale locale);
+ String interpolate(String messageTemplate, Context context, Locale locale);
/**
* Informations related to the interpolation context
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validation.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validation.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validation.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -37,7 +37,7 @@
* to bootstrap the framework:
* <ul>
* <li>
- * The easiest approach is to use the default Bean Validation provider.
+ * The easiest approach is to build the default ValidatorFactory.
* <pre>
* ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
* </pre>
@@ -99,7 +99,7 @@
public class Validation {
/**
- * Build and return a ValidatorFactory instanced based on the
+ * Build and return a ValidatorFactory instance based on the
* default Bean Validation provider and following the
* XML configuration.
* <p/>
@@ -125,8 +125,9 @@
* .configure();
* ValidatorFactory factory = configuration.buildValidatorFactory();
* </pre>
- * The actual provider choice is given by the XML configuration. If the XML
- * configuration does not exsist the first available provider will be returned.
+ * The provider can be specified in the XML configuration. If the XML
+ * configuration does not exsist or if no provider is specified,
+ * the first available provider will be returned.
*
* @return instance building a generic <code>Configuration</code>
* compliant with the bootstrap state provided.
@@ -137,7 +138,7 @@
/**
* Build a <code>Configuration</code> for a particular provider implementation.
- * Optionally override the provider resolution strategy used to determine the provider.
+ * Optionally overrides the provider resolution strategy used to determine the provider.
* <p/>
* Used by applications targeting a specific provider programmatically.
* <p/>
@@ -156,7 +157,6 @@
*
* @return instance building a provider specific <code>Configuration</code>
* sub interface implementation.
- *
*/
public static <T extends Configuration<T>>
ProviderSpecificBootstrap<T> byProvider(Class<T> configurationType) {
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validator.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validator.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/Validator.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -42,7 +42,8 @@
<T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups);
/**
- * Validates all constraints on <code>propertyName</code> property of object
+ * Validates all constraints placed on the property named <code>propertyName</code>
+ * of <code>object</code>
*
* @param object object to validate
* @param propertyName property to validate (ie field and getter constraints)
@@ -61,8 +62,8 @@
Class<?>... groups);
/**
- * Validates all constraints on <code>propertyName</code> property
- * if the property value is <code>value</code>
+ * Validates all constraints placed on the property named <code>propertyName</code>
+ * would the property value be <code>value</code>
* <p/>
* <code>ConstraintViolation</code> objects return null for
* {@link ConstraintViolation#getRootBean()} and {@link ConstraintViolation#getLeafBean()}
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ValidatorFactory.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/ValidatorFactory.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/ValidatorFactory.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -26,8 +26,8 @@
*/
public interface ValidatorFactory {
/**
- * @return Returns an initialized <code>Validator</code> instance using the default factory instances
- * for message interpolator and traversable resolver.
+ * @return Returns an initialized <code>Validator</code> instance using the default
+ * factory instances for message interpolator and traversable resolver.
* <p>
* Validator instances can be pooled and shared by the implementation.
* </p>
@@ -35,15 +35,17 @@
Validator getValidator();
/**
- * Define the validator context and return a <code>Validator</code> compliant with this state.
+ * Define the validator context and return a <code>Validator</code> compliant
+ * with this state.
*
* @return a <code>ValidatorContext</code>.
*/
ValidatorContext usingContext();
/**
- * Returns the <code>MessageInterpolator</code> instance configured at initialization time for the <code>ValidatorFactory<code>.
- * This is the instance used by #getValidator(Class).
+ * Returns the <code>MessageInterpolator</code> instance configured at
+ * initialization time for the <code>ValidatorFactory<code>.
+ * This is the instance used by #getValidator().
*
* @return MessageInterpolator instance.
*/
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -6,7 +6,7 @@
/**
* Defines the state used to bootstrap Bean Validation and
* creates a provider specific Configuration. The specific Configuration
- * sub interface uniquely identifying a provider.
+ * sub interface uniquely identifies a provider.
* <p/>
* The requested provider is the first provider suitable for T (as defined in
* {@link javax.validation.spi.ValidationProvider#isSuitable(Class)}). The
@@ -24,7 +24,7 @@
*
* @param resolver ValidationProviderResolver implementation used
*
- * @return self
+ * @return <code>this</code> following the chaining method pattern
*/
public ProviderSpecificBootstrap<T> providerResolver(ValidationProviderResolver resolver);
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ConfigurationState.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ConfigurationState.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ConfigurationState.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -37,7 +37,7 @@
/**
* returns true if Configuration.ignoreXMLConfiguration() has been called
- * In this case, the ValiatorFactory must ignore META-INF/validation.xml
+ * In this case, the ValidatorFactory must ignore META-INF/validation.xml
* @return true if META-INF/validation.xml should be ignored
*/
boolean isIgnoreXmlConfiguration();
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ValidationProvider.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ValidationProvider.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/spi/ValidationProvider.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -31,8 +31,9 @@
*/
public interface ValidationProvider {
/**
- * This sub interface uniquely identify a provider.
- *
+ * Return true if <code>configurationClass</code> is the uniquely identifying
+ * Configuration subclass for this provider
+ *
* @param configurationClass targeted configuration class.
*
* @return <code>true</code> if <code>configurationClass</code> is the Bean Validation Provider
@@ -43,7 +44,7 @@
/**
* Returns a Configuration instance implementing the
* <code>configurationClass</code> interface.
- * The Configuration instance uses the current provider (<code>this</code>)
+ * The returned Configuration instance must use the current provider (<code>this</code>)
* to build the ValidatorFactory instance.
* <p/>
* This method can only be called on providers returning true on
@@ -69,14 +70,14 @@
*
* @param state bootstrap state
*
- * @return Configuration implementation
+ * @return Non specialized Configuration implementation
*/
Configuration<?> createGenericConfiguration(BootstrapState state);
/**
* Build a ValidatorFactory using the current provider implementation. The
- * ValidatorFactory is assembled and follow the configuration passed
- * using ConfigurationState.
+ * ValidatorFactory is assembled and follows the configuration passed
+ * via ConfigurationState.
* <p>
* The returned ValidatorFactory is properly initialized and ready for use.
* </p>
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanDescriptorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanDescriptorImpl.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanDescriptorImpl.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -24,7 +24,7 @@
return metadataBean.getPropertyDescriptor( propertyName );
}
- public Set<String> getConstrainedProperties() {
+ public Set<PropertyDescriptor> getConstrainedProperties() {
return metadataBean.getConstrainedProperties();
}
}
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -79,8 +79,8 @@
PropertyDescriptor getPropertyDescriptor(String property);
/**
- * @return the property names having at least one constraint defined or which are marked
+ * @return the property descriptors having at least one constraint defined or which are marked
* as cascaded (@Valid).
*/
- Set<String> getConstrainedProperties();
+ Set<PropertyDescriptor> getConstrainedProperties();
}
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.HashSet;
import javax.validation.BeanDescriptor;
import javax.validation.GroupSequence;
import javax.validation.PropertyDescriptor;
@@ -362,7 +363,7 @@
return defaultGroupSequence;
}
- public Set<String> getConstrainedProperties() {
- return Collections.unmodifiableSet( propertyDescriptors.keySet() );
+ public Set<PropertyDescriptor> getConstrainedProperties() {
+ return Collections.unmodifiableSet( new HashSet<PropertyDescriptor>(propertyDescriptors.values() ) );
}
}
\ No newline at end of file
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -22,6 +22,7 @@
import javax.validation.ConstraintViolation;
import javax.validation.ValidationException;
import javax.validation.Validator;
+import javax.validation.PropertyDescriptor;
import javax.validation.groups.Default;
import static junit.framework.Assert.assertTrue;
@@ -404,7 +405,7 @@
BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
assertTrue( beanDescriptor.isBeanConstrained() );
- Set<String> constraintProperties = beanDescriptor.getConstrainedProperties();
+ Set<PropertyDescriptor> constraintProperties = beanDescriptor.getConstrainedProperties();
assertTrue( "Each of the properties should have at least one constraint.", constraintProperties.size() == 5 );
Order order = new Order();
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java 2009-03-15 17:22:19 UTC (rev 16160)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java 2009-03-16 23:26:39 UTC (rev 16161)
@@ -95,12 +95,17 @@
public void testGetConstrainedProperties() {
Validator validator = TestUtil.getValidator();
BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
- Set<String> constraintProperties = beanDescriptor.getConstrainedProperties();
+ Set<PropertyDescriptor> constraintProperties = beanDescriptor.getConstrainedProperties();
assertEquals( "There should be only one property", 1, constraintProperties.size() );
- assertTrue( "Wrong property", constraintProperties.contains( "orderNumber" ) );
+ boolean hasOrderNumber = false;
+ for(PropertyDescriptor pd : constraintProperties) {
+ hasOrderNumber |= pd.getPropertyName().equals( "orderNumber" );
+ }
+ assertTrue( "Wrong property", hasOrderNumber );
+
try {
- constraintProperties.add( "foobar" );
+ constraintProperties.add( null );
fail( "Set should be immutable" );
}
catch ( UnsupportedOperationException e ) {
17 years, 1 month
Hibernate SVN: r16160 - core.
by hibernate-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-15 13:22:19 -0400 (Sun, 15 Mar 2009)
New Revision: 16160
Added:
core/webbeans-xsd-generator/
Log:
17 years, 1 month