File tree Expand file tree Collapse file tree 6 files changed +2
-59
lines changed
main/java/org/hibernate/validator
test/java/org/hibernate/validator/test/cfg Expand file tree Collapse file tree 6 files changed +2
-59
lines changed Original file line number Diff line number Diff line change 6
6
*/
7
7
package org .hibernate .validator .cfg .context ;
8
8
9
- import java .lang .annotation .ElementType ;
10
-
11
9
/**
12
10
* Facet of a constraint mapping creational context which allows to select the bean
13
11
* property to which the next operations shall apply.
16
14
* @author Gunnar Morling
17
15
*/
18
16
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 );
37
17
38
18
/**
39
19
* Selects a field to which the next operations shall apply.
Original file line number Diff line number Diff line change 6
6
*/
7
7
package org .hibernate .validator .internal .cfg .context ;
8
8
9
- import java .lang .annotation .ElementType ;
10
-
11
9
import org .hibernate .validator .cfg .context .ConstructorConstraintMappingContext ;
12
10
import org .hibernate .validator .cfg .context .ContainerElementConstraintMappingContext ;
13
11
import org .hibernate .validator .cfg .context .MethodConstraintMappingContext ;
@@ -54,12 +52,6 @@ public PropertyConstraintMappingContext ignoreAnnotations(boolean ignoreAnnotati
54
52
return this ;
55
53
}
56
54
57
- @ Override
58
- @ SuppressWarnings ("deprecation" )
59
- public PropertyConstraintMappingContext property (String property , ElementType elementType ) {
60
- return typeContext .property ( property , elementType );
61
- }
62
-
63
55
@ Override
64
56
public PropertyConstraintMappingContext field (String property ) {
65
57
return typeContext .field ( property );
Original file line number Diff line number Diff line change 7
7
package org .hibernate .validator .internal .cfg .context ;
8
8
9
9
import java .lang .annotation .Annotation ;
10
- import java .lang .annotation .ElementType ;
11
10
import java .lang .invoke .MethodHandles ;
12
11
import java .lang .reflect .ParameterizedType ;
13
12
import java .lang .reflect .Type ;
@@ -117,12 +116,6 @@ protected ContainerElementConstraintMappingContext getThis() {
117
116
return this ;
118
117
}
119
118
120
- @ Override
121
- @ Deprecated
122
- public PropertyConstraintMappingContext property (String property , ElementType elementType ) {
123
- return typeContext .property ( property , elementType );
124
- }
125
-
126
119
@ Override
127
120
public PropertyConstraintMappingContext field (String property ) {
128
121
return typeContext .field ( property );
Original file line number Diff line number Diff line change @@ -103,23 +103,6 @@ public TypeConstraintMappingContext<C> defaultGroupSequenceProviderClass(Class<?
103
103
return this ;
104
104
}
105
105
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
-
123
106
@ Override
124
107
public PropertyConstraintMappingContext field (String property ) {
125
108
Contracts .assertNotEmpty ( property , MESSAGES .propertyNameMustNotBeEmpty () );
Original file line number Diff line number Diff line change @@ -348,9 +348,6 @@ RuntimeException getTryingToInstantiateAnnotationWithUnknownAttributesException(
348
348
@ Message (id = 87 , value = "Property name cannot be null or empty." )
349
349
IllegalArgumentException getPropertyNameCannotBeNullOrEmptyException ();
350
350
351
- @ Message (id = 88 , value = "Element type has to be FIELD or METHOD." )
352
- IllegalArgumentException getElementTypeHasToBeFieldOrMethodException ();
353
-
354
351
@ Message (id = 89 , value = "Member %s is neither a field nor a method." )
355
352
IllegalArgumentException getMemberIsNeitherAFieldNorAMethodException (Member member );
356
353
Original file line number Diff line number Diff line change 13
13
import static org .testng .Assert .assertEquals ;
14
14
import static org .testng .Assert .assertNotNull ;
15
15
16
- import java .lang .annotation .ElementType ;
17
16
import java .util .Arrays ;
18
17
import java .util .Calendar ;
19
18
import java .util .GregorianCalendar ;
@@ -528,13 +527,12 @@ public void testProgrammaticAndAnnotationPropertyConstraintsAddUp() {
528
527
}
529
528
530
529
@ Test
531
- @ SuppressWarnings ("deprecation" )
532
530
public void testDeprecatedPropertyMethodForFieldAndGetterProgrammaticConstraintDefinition () {
533
531
mapping .type ( Marathon .class )
534
- .property ( "name" , ElementType . METHOD )
532
+ .getter ( "name" )
535
533
.constraint ( new SizeDef ().min ( 5 ) )
536
534
.constraint ( new SizeDef ().min ( 10 ) )
537
- .property ( "runners" , ElementType . FIELD )
535
+ .field ( "runners" )
538
536
.constraint ( new SizeDef ().max ( 10 ).min ( 1 ) );
539
537
config .addMapping ( mapping );
540
538
Validator validator = config .buildValidatorFactory ().getValidator ();
You can’t perform that action at this time.
0 commit comments