@@ -41,12 +41,6 @@ public class POJOPropertiesCollector
41
41
*/
42
42
protected final boolean _forSerialization ;
43
43
44
- /**
45
- * @since 2.5
46
- */
47
- @ Deprecated
48
- protected final boolean _stdBeanNaming ;
49
-
50
44
/**
51
45
* Type of POJO for which properties are being collected.
52
46
*/
@@ -66,13 +60,6 @@ public class POJOPropertiesCollector
66
60
*/
67
61
protected final boolean _useAnnotations ;
68
62
69
- /**
70
- * Prefix used by auto-detected mutators ("setters"): usually "set",
71
- * but differs for builder objects ("with" by default).
72
- */
73
- @ Deprecated
74
- protected final String _mutatorPrefix ;
75
-
76
63
/*
77
64
/**********************************************************
78
65
/* Collected property information
@@ -150,35 +137,38 @@ public class POJOPropertiesCollector
150
137
* value injection.
151
138
*/
152
139
protected LinkedHashMap <Object , AnnotatedMember > _injectables ;
140
+
141
+ // // // Deprecated entries to remove from 3.0
153
142
143
+ /**
144
+ * @deprecated Since 2.12
145
+ */
146
+ @ Deprecated
147
+ protected final boolean _stdBeanNaming ;
148
+
149
+ /**
150
+ * @deprecated Since 2.12
151
+ */
152
+ @ Deprecated
153
+ protected String _mutatorPrefix = "set" ;
154
+
154
155
/*
155
156
/**********************************************************
156
157
/* Life-cycle
157
158
/**********************************************************
158
159
*/
159
160
160
- @ Deprecated
161
- protected POJOPropertiesCollector (MapperConfig <?> config , boolean forSerialization ,
162
- JavaType type , AnnotatedClass classDef , String mutatorPrefix )
163
- {
164
- this (config , forSerialization , type , classDef , null , mutatorPrefix );
165
- }
166
-
161
+ /**
162
+ * @since 2.12
163
+ */
167
164
protected POJOPropertiesCollector (MapperConfig <?> config , boolean forSerialization ,
168
- JavaType type , AnnotatedClass classDef , AccessorNamingStrategy accessorNaming )
169
- {
170
- this (config , forSerialization , type , classDef , accessorNaming , null );
171
- }
172
-
173
- private POJOPropertiesCollector (MapperConfig <?> config , boolean forSerialization ,
174
- JavaType type , AnnotatedClass classDef , AccessorNamingStrategy accessorNaming , String mutatorPrefix )
165
+ JavaType type , AnnotatedClass classDef ,
166
+ AccessorNamingStrategy accessorNaming )
175
167
{
176
168
_config = config ;
177
- _stdBeanNaming = config .isEnabled (MapperFeature .USE_STD_BEAN_NAMING );
178
169
_forSerialization = forSerialization ;
179
170
_type = type ;
180
171
_classDef = classDef ;
181
- _mutatorPrefix = (mutatorPrefix == null ) ? "set" : mutatorPrefix ;
182
172
if (config .isAnnotationProcessingEnabled ()) {
183
173
_useAnnotations = true ;
184
174
_annotationIntrospector = _config .getAnnotationIntrospector ();
@@ -188,8 +178,32 @@ private POJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization
188
178
}
189
179
_visibilityChecker = _config .getDefaultVisibilityChecker (type .getRawClass (),
190
180
classDef );
191
- _accessorNaming = (null != accessorNaming ) ? accessorNaming :
192
- new DefaultAccessorNamingStrategy .Provider ().withSetterPrefix (mutatorPrefix ).forPOJO (config , classDef );
181
+ _accessorNaming = accessorNaming ;
182
+
183
+ // for backwards-compatibility only
184
+ _stdBeanNaming = config .isEnabled (MapperFeature .USE_STD_BEAN_NAMING );
185
+ }
186
+
187
+ /**
188
+ * @deprecated Since 2.12
189
+ */
190
+ @ Deprecated
191
+ protected POJOPropertiesCollector (MapperConfig <?> config , boolean forSerialization ,
192
+ JavaType type , AnnotatedClass classDef ,
193
+ String mutatorPrefix )
194
+ {
195
+ this (config , forSerialization , type , classDef ,
196
+ _accessorNaming (config , classDef , mutatorPrefix ));
197
+ _mutatorPrefix = mutatorPrefix ;
198
+ }
199
+
200
+ private static AccessorNamingStrategy _accessorNaming (MapperConfig <?> config , AnnotatedClass classDef ,
201
+ String mutatorPrefix ) {
202
+ if (mutatorPrefix == null ) {
203
+ mutatorPrefix = "set" ;
204
+ }
205
+ return new DefaultAccessorNamingStrategy .Provider ()
206
+ .withSetterPrefix (mutatorPrefix ).forPOJO (config , classDef );
193
207
}
194
208
195
209
/*
@@ -993,9 +1007,7 @@ protected void _renameProperties(Map<String, POJOPropertyBuilder> props)
993
1007
old .addAll (prop );
994
1008
}
995
1009
// replace the creatorProperty too, if there is one
996
- MonitoredList <POJOPropertyBuilder > monitored = MonitoredList .monitor (_creatorProperties );
997
- _updateCreatorProperty (prop , monitored );
998
- if (null != monitored && monitored .isModified ()) {
1010
+ if (_updateCreatorProperty (prop , _creatorProperties )) {
999
1011
// [databind#2001]: New name of property was ignored previously? Remove from ignored
1000
1012
// 01-May-2018, tatu: I have a feeling this will need to be revisited at some point,
1001
1013
// to avoid removing some types of removals, possibly. But will do for now.
@@ -1307,59 +1319,16 @@ private PropertyNamingStrategy _findNamingStrategy()
1307
1319
_config .canOverrideAccessModifiers ());
1308
1320
}
1309
1321
1310
- protected void _updateCreatorProperty (POJOPropertyBuilder prop , List <POJOPropertyBuilder > creatorProperties ) {
1311
-
1322
+ protected boolean _updateCreatorProperty (POJOPropertyBuilder prop , List <POJOPropertyBuilder > creatorProperties ) {
1312
1323
if (creatorProperties != null ) {
1313
1324
final String intName = prop .getInternalName ();
1314
1325
for (int i = 0 , len = creatorProperties .size (); i < len ; ++i ) {
1315
1326
if (creatorProperties .get (i ).getInternalName ().equals (intName )) {
1316
1327
creatorProperties .set (i , prop );
1317
- break ;
1328
+ return true ;
1318
1329
}
1319
1330
}
1320
1331
}
1321
- }
1322
-
1323
- private static class MonitoredList <T > extends AbstractList <T > {
1324
- private final List <T > delegate ;
1325
- private boolean modified ;
1326
-
1327
- public MonitoredList (List <T > delegate ) {
1328
- this .delegate = delegate ;
1329
- this .modified = false ;
1330
- }
1331
-
1332
- @ Override
1333
- public T get (int index ) {
1334
- return this .delegate .get (index );
1335
- }
1336
-
1337
- @ Override
1338
- public int size () {
1339
- return this .delegate .size ();
1340
- }
1341
-
1342
- public T set (int index , T element ) {
1343
- this .modified = true ;
1344
- return this .delegate .set (index , element );
1345
- }
1346
-
1347
- public void add (int index , T element ) {
1348
- this .modified = true ;
1349
- this .delegate .add (index , element );
1350
- }
1351
-
1352
- public T remove (int index ) {
1353
- this .modified = true ;
1354
- return this .delegate .remove (index );
1355
- }
1356
-
1357
- public boolean isModified () {
1358
- return this .modified ;
1359
- }
1360
-
1361
- public static <T > MonitoredList <T > monitor (List <T > source ) {
1362
- return null == source ? null : new MonitoredList <>(source );
1363
- }
1332
+ return false ;
1364
1333
}
1365
1334
}
0 commit comments