Skip to content

Commit c7112ff

Browse files
committed
Implemented #203
1 parent c77d91b commit c7112ff

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

release-notes/VERSION

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ New features:
5050
#195: Add 'MapperFeature.INFER_PROPERTY_MUTATORS' (default: enabled) for finer
5151
control of what mutators are auto-detected.
5252
(requested by Dain S)
53+
#203: Added new features to support advanced date/time handling:
54+
- SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
55+
- DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS
56+
- DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE
5357

5458
Other:
5559

src/main/java/com/fasterxml/jackson/databind/DeserializationFeature.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public enum DeserializationFeature implements ConfigFeature
175175
* Feature is disabled by default.
176176
*/
177177
ACCEPT_SINGLE_VALUE_AS_ARRAY(false),
178-
178+
179179
/**
180180
* Feature to allow "unwrapping" root-level JSON value, to match setting of
181181
* {@link SerializationFeature#WRAP_ROOT_VALUE} used for serialization.
@@ -222,6 +222,18 @@ public enum DeserializationFeature implements ConfigFeature
222222
*/
223223
READ_UNKNOWN_ENUM_VALUES_AS_NULL(false),
224224

225+
/**
226+
* Feature that controls whether numeric timestamp values are expected
227+
* to be written using nanosecond timestamps (enabled) or not (disabled);
228+
* if disabled, standard millisecond timestamps are assumed.
229+
* This is the counterpart to {@link SerializationFeature#WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS}.
230+
*<p>
231+
* Feature is disabled by default.
232+
*
233+
* @since 2.2
234+
*/
235+
READ_DATE_TIMESTAMPS_AS_NANOSECONDS(false),
236+
225237
/*
226238
/******************************************************
227239
/* Other

src/main/java/com/fasterxml/jackson/databind/SerializationFeature.java

+25-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public enum SerializationFeature implements ConfigFeature
5757

5858
/*
5959
/******************************************************
60-
/* Error handling features
60+
/* Error handling features
6161
/******************************************************
6262
*/
6363

@@ -265,6 +265,18 @@ public enum SerializationFeature implements ConfigFeature
265265
*/
266266
WRITE_BIGDECIMAL_AS_PLAIN(false),
267267

268+
/**
269+
* Feature that controls whether numeric timestamp values are
270+
* to be written using nanosecond timestamps (enabled) or not (disabled);
271+
* if disabled, standard millisecond timestamps are assumed.
272+
* This is the counterpart to {@link DeserializationFeature#READ_DATE_TIMESTAMPS_AS_NANOSECONDS}.
273+
*<p>
274+
* Feature is disabled by default.
275+
*
276+
* @since 2.2
277+
*/
278+
WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS(false),
279+
268280
/**
269281
* Feature that determines whether {@link java.util.Map} entries are first
270282
* sorted by key before serialization or not: if enabled, additional sorting
@@ -275,6 +287,18 @@ public enum SerializationFeature implements ConfigFeature
275287
*/
276288
ORDER_MAP_ENTRIES_BY_KEYS(false),
277289

290+
/**
291+
* Feature that specifies whether context provided {@link java.util.TimeZone}
292+
* ({@link SerializerProvider#getTimeZone()} should be used to adjust Date/Time
293+
* values on deserialization, even if value itself contains timezone information.
294+
* If enabled, contextual <code>TimeZone</code> will essentially override any other
295+
* TimeZone information; if disabled, it will only be used if value itself does not
296+
* contain any TimeZone information.
297+
*
298+
* @since 2.2
299+
*/
300+
ADJUST_DATES_TO_CONTEXT_TIME_ZONE(true),
301+
278302
/*
279303
/******************************************************
280304
/* Other

0 commit comments

Comments
 (0)