55import java .util .TimeZone ;
66
77import com .fasterxml .jackson .core .Base64Variant ;
8+
89import com .fasterxml .jackson .databind .*;
10+ import com .fasterxml .jackson .databind .introspect .AccessorNamingStrategy ;
911import com .fasterxml .jackson .databind .introspect .AnnotationIntrospectorPair ;
1012import com .fasterxml .jackson .databind .introspect .ClassIntrospector ;
13+ import com .fasterxml .jackson .databind .introspect .DefaultAccessorNamingStrategy ;
1114import com .fasterxml .jackson .databind .jsontype .PolymorphicTypeValidator ;
1215import com .fasterxml .jackson .databind .jsontype .TypeResolverBuilder ;
1316import com .fasterxml .jackson .databind .type .TypeFactory ;
@@ -39,7 +42,14 @@ public final class BaseSettings
3942 /* Configuration settings; introspection, related
4043 /**********************************************************
4144 */
42-
45+
46+ /**
47+ * Specific factory used for creating {@link JavaType} instances;
48+ * needed to allow modules to add more custom type handling
49+ * (mostly to support types of non-Java JVM languages)
50+ */
51+ protected final TypeFactory _typeFactory ;
52+
4353 /**
4454 * Introspector used to figure out Bean properties needed for bean serialization
4555 * and deserialization. Overridable so that it is possible to change low-level
@@ -58,15 +68,15 @@ public final class BaseSettings
5868 protected final PropertyNamingStrategy _propertyNamingStrategy ;
5969
6070 /**
61- * Specific factory used for creating {@link JavaType } instances;
62- * needed to allow modules to add more custom type handling
63- * (mostly to support types of non-Java JVM languages)
71+ * Provider for creating {@link AccessorNamingStrategy } instances to use
72+ *
73+ * @since 2.12
6474 */
65- protected final TypeFactory _typeFactory ;
75+ protected final AccessorNamingStrategy . Provider _accessorNaming ;
6676
6777 /*
6878 /**********************************************************
69- /* Configuration settings; poly type resolution
79+ /* Configuration settings; polymorphic type resolution
7080 /**********************************************************
7181 */
7282
@@ -140,13 +150,13 @@ public final class BaseSettings
140150 */
141151
142152 /**
143- * @since 2.10
153+ * @since 2.12
144154 */
145155 public BaseSettings (ClassIntrospector ci , AnnotationIntrospector ai ,
146156 PropertyNamingStrategy pns , TypeFactory tf ,
147157 TypeResolverBuilder <?> typer , DateFormat dateFormat , HandlerInstantiator hi ,
148158 Locale locale , TimeZone tz , Base64Variant defaultBase64 ,
149- PolymorphicTypeValidator ptv )
159+ PolymorphicTypeValidator ptv , AccessorNamingStrategy . Provider accNaming )
150160 {
151161 _classIntrospector = ci ;
152162 _annotationIntrospector = ai ;
@@ -159,15 +169,18 @@ public BaseSettings(ClassIntrospector ci, AnnotationIntrospector ai,
159169 _timeZone = tz ;
160170 _defaultBase64 = defaultBase64 ;
161171 _typeValidator = ptv ;
172+ _accessorNaming = accNaming ;
162173 }
163174
164- @ Deprecated // since 2.10
175+ @ Deprecated // since 2.12
165176 public BaseSettings (ClassIntrospector ci , AnnotationIntrospector ai ,
166177 PropertyNamingStrategy pns , TypeFactory tf ,
167178 TypeResolverBuilder <?> typer , DateFormat dateFormat , HandlerInstantiator hi ,
168- Locale locale , TimeZone tz , Base64Variant defaultBase64 )
179+ Locale locale , TimeZone tz , Base64Variant defaultBase64 ,
180+ PolymorphicTypeValidator ptv )
169181 {
170- this (ci , ai , pns , tf , typer , dateFormat , hi , locale , tz , defaultBase64 , null );
182+ this (ci , ai , pns , tf , typer , dateFormat , hi , locale , tz , defaultBase64 , ptv ,
183+ new DefaultAccessorNamingStrategy .Provider ());
171184 }
172185
173186 /**
@@ -187,8 +200,8 @@ public BaseSettings copy() {
187200 _locale ,
188201 _timeZone ,
189202 _defaultBase64 ,
190- _typeValidator );
191-
203+ _typeValidator ,
204+ _accessorNaming );
192205 }
193206
194207 /*
@@ -203,7 +216,7 @@ public BaseSettings withClassIntrospector(ClassIntrospector ci) {
203216 }
204217 return new BaseSettings (ci , _annotationIntrospector , _propertyNamingStrategy , _typeFactory ,
205218 _typeResolverBuilder , _dateFormat , _handlerInstantiator , _locale ,
206- _timeZone , _defaultBase64 , _typeValidator );
219+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
207220 }
208221
209222 public BaseSettings withAnnotationIntrospector (AnnotationIntrospector ai ) {
@@ -212,7 +225,7 @@ public BaseSettings withAnnotationIntrospector(AnnotationIntrospector ai) {
212225 }
213226 return new BaseSettings (_classIntrospector , ai , _propertyNamingStrategy , _typeFactory ,
214227 _typeResolverBuilder , _dateFormat , _handlerInstantiator , _locale ,
215- _timeZone , _defaultBase64 , _typeValidator );
228+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
216229 }
217230
218231 public BaseSettings withInsertedAnnotationIntrospector (AnnotationIntrospector ai ) {
@@ -239,7 +252,17 @@ public BaseSettings withPropertyNamingStrategy(PropertyNamingStrategy pns) {
239252 }
240253 return new BaseSettings (_classIntrospector , _annotationIntrospector , pns , _typeFactory ,
241254 _typeResolverBuilder , _dateFormat , _handlerInstantiator , _locale ,
242- _timeZone , _defaultBase64 , _typeValidator );
255+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
256+ }
257+
258+ // @since 2.12
259+ public BaseSettings withAccessorNaming (AccessorNamingStrategy .Provider p ) {
260+ if (_accessorNaming == p ) {
261+ return this ;
262+ }
263+ return new BaseSettings (_classIntrospector , _annotationIntrospector , _propertyNamingStrategy , _typeFactory ,
264+ _typeResolverBuilder , _dateFormat , _handlerInstantiator , _locale ,
265+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
243266 }
244267
245268 public BaseSettings withTypeFactory (TypeFactory tf ) {
@@ -248,7 +271,7 @@ public BaseSettings withTypeFactory(TypeFactory tf) {
248271 }
249272 return new BaseSettings (_classIntrospector , _annotationIntrospector , _propertyNamingStrategy , tf ,
250273 _typeResolverBuilder , _dateFormat , _handlerInstantiator , _locale ,
251- _timeZone , _defaultBase64 , _typeValidator );
274+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
252275 }
253276
254277 public BaseSettings withTypeResolverBuilder (TypeResolverBuilder <?> typer ) {
@@ -257,7 +280,7 @@ public BaseSettings withTypeResolverBuilder(TypeResolverBuilder<?> typer) {
257280 }
258281 return new BaseSettings (_classIntrospector , _annotationIntrospector , _propertyNamingStrategy , _typeFactory ,
259282 typer , _dateFormat , _handlerInstantiator , _locale ,
260- _timeZone , _defaultBase64 , _typeValidator );
283+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
261284 }
262285
263286 public BaseSettings withDateFormat (DateFormat df ) {
@@ -271,7 +294,7 @@ public BaseSettings withDateFormat(DateFormat df) {
271294 }
272295 return new BaseSettings (_classIntrospector , _annotationIntrospector , _propertyNamingStrategy , _typeFactory ,
273296 _typeResolverBuilder , df , _handlerInstantiator , _locale ,
274- _timeZone , _defaultBase64 , _typeValidator );
297+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
275298 }
276299
277300 public BaseSettings withHandlerInstantiator (HandlerInstantiator hi ) {
@@ -280,7 +303,7 @@ public BaseSettings withHandlerInstantiator(HandlerInstantiator hi) {
280303 }
281304 return new BaseSettings (_classIntrospector , _annotationIntrospector , _propertyNamingStrategy , _typeFactory ,
282305 _typeResolverBuilder , _dateFormat , hi , _locale ,
283- _timeZone , _defaultBase64 , _typeValidator );
306+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
284307 }
285308
286309 public BaseSettings with (Locale l ) {
@@ -289,7 +312,7 @@ public BaseSettings with(Locale l) {
289312 }
290313 return new BaseSettings (_classIntrospector , _annotationIntrospector , _propertyNamingStrategy , _typeFactory ,
291314 _typeResolverBuilder , _dateFormat , _handlerInstantiator , l ,
292- _timeZone , _defaultBase64 , _typeValidator );
315+ _timeZone , _defaultBase64 , _typeValidator , _accessorNaming );
293316 }
294317
295318 /**
@@ -310,7 +333,7 @@ public BaseSettings with(TimeZone tz)
310333 return new BaseSettings (_classIntrospector , _annotationIntrospector ,
311334 _propertyNamingStrategy , _typeFactory ,
312335 _typeResolverBuilder , df , _handlerInstantiator , _locale ,
313- tz , _defaultBase64 , _typeValidator );
336+ tz , _defaultBase64 , _typeValidator , _accessorNaming );
314337 }
315338
316339 /**
@@ -323,7 +346,7 @@ public BaseSettings with(Base64Variant base64) {
323346 return new BaseSettings (_classIntrospector , _annotationIntrospector ,
324347 _propertyNamingStrategy , _typeFactory ,
325348 _typeResolverBuilder , _dateFormat , _handlerInstantiator , _locale ,
326- _timeZone , base64 , _typeValidator );
349+ _timeZone , base64 , _typeValidator , _accessorNaming );
327350 }
328351
329352 /**
@@ -336,7 +359,7 @@ public BaseSettings with(PolymorphicTypeValidator v) {
336359 return new BaseSettings (_classIntrospector , _annotationIntrospector ,
337360 _propertyNamingStrategy , _typeFactory ,
338361 _typeResolverBuilder , _dateFormat , _handlerInstantiator , _locale ,
339- _timeZone , _defaultBase64 , v );
362+ _timeZone , _defaultBase64 , v , _accessorNaming );
340363 }
341364
342365 /*
@@ -357,6 +380,10 @@ public PropertyNamingStrategy getPropertyNamingStrategy() {
357380 return _propertyNamingStrategy ;
358381 }
359382
383+ public AccessorNamingStrategy .Provider getAccessorNaming () {
384+ return _accessorNaming ;
385+ }
386+
360387 public TypeFactory getTypeFactory () {
361388 return _typeFactory ;
362389 }
0 commit comments