Skip to content

Commit 5a6d58f

Browse files
committed
HV-2043 Remove deprecated PropertyTarget#property
1 parent fa306c9 commit 5a6d58f

File tree

6 files changed

+2
-59
lines changed

6 files changed

+2
-59
lines changed

engine/src/main/java/org/hibernate/validator/cfg/context/PropertyTarget.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
*/
77
package org.hibernate.validator.cfg.context;
88

9-
import java.lang.annotation.ElementType;
10-
119
/**
1210
* Facet of a constraint mapping creational context which allows to select the bean
1311
* property to which the next operations shall apply.
@@ -16,24 +14,6 @@
1614
* @author Gunnar Morling
1715
*/
1816
public interface PropertyTarget {
19-
/**
20-
* Selects a property to which the next operations shall apply.
21-
* <p>
22-
* Until this method is called constraints apply on class level. After calling this method constraints
23-
* apply on the specified property with the given access type.
24-
* <p>
25-
* A given property may only be configured once.
26-
*
27-
* @param property The property on which to apply the following constraints (Java Bean notation).
28-
* @param type The access type (field/property).
29-
*
30-
* @return A creational context representing the selected property.
31-
*
32-
* @deprecated Since 6.1. Planned for removal. Use either {@link PropertyTarget#field(String)} or
33-
* {@link PropertyTarget#getter(String)} instead.
34-
*/
35-
@Deprecated
36-
PropertyConstraintMappingContext property(String property, ElementType type);
3717

3818
/**
3919
* Selects a field to which the next operations shall apply.

engine/src/main/java/org/hibernate/validator/internal/cfg/context/AbstractPropertyConstraintMappingContextImpl.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
*/
77
package org.hibernate.validator.internal.cfg.context;
88

9-
import java.lang.annotation.ElementType;
10-
119
import org.hibernate.validator.cfg.context.ConstructorConstraintMappingContext;
1210
import org.hibernate.validator.cfg.context.ContainerElementConstraintMappingContext;
1311
import org.hibernate.validator.cfg.context.MethodConstraintMappingContext;
@@ -54,12 +52,6 @@ public PropertyConstraintMappingContext ignoreAnnotations(boolean ignoreAnnotati
5452
return this;
5553
}
5654

57-
@Override
58-
@SuppressWarnings("deprecation")
59-
public PropertyConstraintMappingContext property(String property, ElementType elementType) {
60-
return typeContext.property( property, elementType );
61-
}
62-
6355
@Override
6456
public PropertyConstraintMappingContext field(String property) {
6557
return typeContext.field( property );

engine/src/main/java/org/hibernate/validator/internal/cfg/context/ContainerElementConstraintMappingContextImpl.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package org.hibernate.validator.internal.cfg.context;
88

99
import java.lang.annotation.Annotation;
10-
import java.lang.annotation.ElementType;
1110
import java.lang.invoke.MethodHandles;
1211
import java.lang.reflect.ParameterizedType;
1312
import java.lang.reflect.Type;
@@ -117,12 +116,6 @@ protected ContainerElementConstraintMappingContext getThis() {
117116
return this;
118117
}
119118

120-
@Override
121-
@Deprecated
122-
public PropertyConstraintMappingContext property(String property, ElementType elementType) {
123-
return typeContext.property( property, elementType );
124-
}
125-
126119
@Override
127120
public PropertyConstraintMappingContext field(String property) {
128121
return typeContext.field( property );

engine/src/main/java/org/hibernate/validator/internal/cfg/context/TypeConstraintMappingContextImpl.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,6 @@ public TypeConstraintMappingContext<C> defaultGroupSequenceProviderClass(Class<?
103103
return this;
104104
}
105105

106-
@Override
107-
@Deprecated
108-
public PropertyConstraintMappingContext property(String property, ElementType elementType) {
109-
Contracts.assertNotNull( elementType, "The element type must not be null." );
110-
111-
if ( !( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) ) {
112-
throw LOG.getElementTypeHasToBeFieldOrMethodException();
113-
}
114-
115-
if ( ElementType.FIELD == elementType ) {
116-
return field( property );
117-
}
118-
else {
119-
return getter( property );
120-
}
121-
}
122-
123106
@Override
124107
public PropertyConstraintMappingContext field(String property) {
125108
Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() );

engine/src/main/java/org/hibernate/validator/internal/util/logging/Log.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,6 @@ RuntimeException getTryingToInstantiateAnnotationWithUnknownAttributesException(
348348
@Message(id = 87, value = "Property name cannot be null or empty.")
349349
IllegalArgumentException getPropertyNameCannotBeNullOrEmptyException();
350350

351-
@Message(id = 88, value = "Element type has to be FIELD or METHOD.")
352-
IllegalArgumentException getElementTypeHasToBeFieldOrMethodException();
353-
354351
@Message(id = 89, value = "Member %s is neither a field nor a method.")
355352
IllegalArgumentException getMemberIsNeitherAFieldNorAMethodException(Member member);
356353

engine/src/test/java/org/hibernate/validator/test/cfg/ConstraintMappingTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import static org.testng.Assert.assertEquals;
1414
import static org.testng.Assert.assertNotNull;
1515

16-
import java.lang.annotation.ElementType;
1716
import java.util.Arrays;
1817
import java.util.Calendar;
1918
import java.util.GregorianCalendar;
@@ -528,13 +527,12 @@ public void testProgrammaticAndAnnotationPropertyConstraintsAddUp() {
528527
}
529528

530529
@Test
531-
@SuppressWarnings("deprecation")
532530
public void testDeprecatedPropertyMethodForFieldAndGetterProgrammaticConstraintDefinition() {
533531
mapping.type( Marathon.class )
534-
.property( "name", ElementType.METHOD )
532+
.getter( "name" )
535533
.constraint( new SizeDef().min( 5 ) )
536534
.constraint( new SizeDef().min( 10 ) )
537-
.property( "runners", ElementType.FIELD )
535+
.field( "runners" )
538536
.constraint( new SizeDef().max( 10 ).min( 1 ) );
539537
config.addMapping( mapping );
540538
Validator validator = config.buildValidatorFactory().getValidator();

0 commit comments

Comments
 (0)