Author: hardy.ferentschik
Date: 2009-06-22 06:59:55 -0400 (Mon, 22 Jun 2009)
New Revision: 16849
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java
Log:
Made sure that the implicit group for a class implementing an interface only applies for
the class, not the interface.
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java 2009-06-22
10:59:08 UTC (rev 16848)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java 2009-06-22
10:59:55 UTC (rev 16849)
@@ -21,6 +21,9 @@
}
public PropertyDescriptor getConstraintsForProperty(String propertyName) {
+ if ( propertyName == null ) {
+ throw new IllegalArgumentException( "The property name cannot be null" );
+ }
return metadataBean.getPropertyDescriptor( propertyName );
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java 2009-06-22
10:59:08 UTC (rev 16848)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java 2009-06-22
10:59:55 UTC (rev 16849)
@@ -331,7 +331,7 @@
@SuppressWarnings("unchecked")
private <A extends Annotation> ConstraintDescriptorImpl
buildConstraintDescriptor(Class<?> clazz, A annotation) {
ConstraintDescriptorImpl constraintDescriptor;
- if ( clazz.isInterface() ) {
+ if ( clazz.isInterface() && !clazz.equals( beanClass)) {
constraintDescriptor = new ConstraintDescriptorImpl( annotation, constraintHelper,
clazz );
}
else {
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java 2009-06-22
10:59:08 UTC (rev 16848)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintDescriptorImpl.java 2009-06-22
10:59:55 UTC (rev 16849)
@@ -93,7 +93,10 @@
public ConstraintDescriptorImpl(T annotation, ConstraintHelper constraintHelper,
Class<?> implicitGroup) {
this( annotation, constraintHelper );
- this.groups.add( implicitGroup );
+ // if the constraint is part of the Default group it is automatically part of the
implicit group as well
+ if ( groups.contains( Default.class ) ) {
+ this.groups.add( implicitGroup );
+ }
}
Show replies by date