|
5 | 5 | import java.text.DateFormat;
|
6 | 6 | import java.util.*;
|
7 | 7 | import java.util.function.Consumer;
|
8 |
| -import java.util.function.UnaryOperator; |
9 | 8 |
|
10 | 9 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
11 | 10 | import com.fasterxml.jackson.annotation.JsonInclude;
|
|
25 | 24 | import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
|
26 | 25 | import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
27 | 26 | import com.fasterxml.jackson.databind.ser.*;
|
| 27 | +import com.fasterxml.jackson.databind.type.LogicalType; |
28 | 28 | import com.fasterxml.jackson.databind.type.TypeFactory;
|
29 | 29 |
|
30 | 30 | /**
|
@@ -271,7 +271,45 @@ public B withConfigOverride(Class<?> forType,
|
271 | 271 | /* Changing settings, coercion config
|
272 | 272 | /**********************************************************************
|
273 | 273 | */
|
274 |
| - |
| 274 | + |
| 275 | + /** |
| 276 | + * Method for changing coercion config for specific logical types, through |
| 277 | + * callback to specific handler. |
| 278 | + * |
| 279 | + * @since 2.13 |
| 280 | + */ |
| 281 | + public B withCoercionConfig(LogicalType forType, |
| 282 | + Consumer<MutableCoercionConfig> handler) { |
| 283 | + handler.accept(_mapper.coercionConfigFor(forType)); |
| 284 | + return _this(); |
| 285 | + } |
| 286 | + |
| 287 | + /** |
| 288 | + * Method for changing coercion config for specific physical type, through |
| 289 | + * callback to specific handler. |
| 290 | + * |
| 291 | + * @since 2.13 |
| 292 | + */ |
| 293 | + public B withCoercionConfig(Class<?> forType, |
| 294 | + Consumer<MutableCoercionConfig> handler) { |
| 295 | + handler.accept(_mapper.coercionConfigFor(forType)); |
| 296 | + return _this(); |
| 297 | + } |
| 298 | + |
| 299 | + /** |
| 300 | + * Method for changing target-type-independent coercion configuration defaults. |
| 301 | + * |
| 302 | + * @since 2.13 |
| 303 | + */ |
| 304 | + public B withCoercionConfigDefaults(Consumer<MutableCoercionConfig> handler) { |
| 305 | + handler.accept(_mapper.coercionConfigDefaults()); |
| 306 | + return _this(); |
| 307 | + } |
| 308 | + |
| 309 | + // Not possible to support these in 2.x, yet (added in 3.0); would require |
| 310 | + // access to "ConfigOverrides" that `ObjectMapper` holds |
| 311 | +// public B withAllCoercionConfigs(Consumer<CoercionConfigs> handler) |
| 312 | + |
275 | 313 | /*
|
276 | 314 | /**********************************************************************
|
277 | 315 | /* Module registration, discovery, access
|
|
0 commit comments