Skip to content

Commit 01c27c0

Browse files
committed
Sync with databind changes
1 parent dc40ef7 commit 01c27c0

File tree

6 files changed

+50
-53
lines changed

6 files changed

+50
-53
lines changed

cbor/src/main/java/tools/jackson/dataformat/cbor/CBORMapper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import tools.jackson.databind.ObjectMapper;
66
import tools.jackson.databind.cfg.MapperBuilder;
77
import tools.jackson.databind.cfg.MapperBuilderState;
8-
import tools.jackson.dataformat.cbor.PackageVersion;
98

109
/**
1110
* Specialized {@link ObjectMapper} to use with CBOR format backend.

ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantDeserializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
import tools.jackson.databind.BeanProperty;
1717
import tools.jackson.databind.DeserializationContext;
18-
import tools.jackson.databind.DeserializationFeature;
1918
import tools.jackson.databind.ValueDeserializer;
19+
import tools.jackson.databind.cfg.DateTimeFeature;
2020
import tools.jackson.databind.deser.std.StdScalarDeserializer;
2121

2222
/**
@@ -94,7 +94,7 @@ private T fromDecimal(BigDecimal decimalValue, ZoneId defaultZoneId) {
9494
}
9595

9696
private T fromLong(long longValue, ZoneId defaultZoneId, DeserializationContext context) {
97-
if(context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)){
97+
if(context.isEnabled(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)){
9898
return fromInstant.apply(Instant.ofEpochSecond(longValue, 0), defaultZoneId);
9999
}
100100
return fromInstant.apply(Instant.ofEpochMilli(longValue), defaultZoneId);

ion/src/test/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantDeserializerTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import org.junit.jupiter.api.Test;
1111
import org.junit.jupiter.api.Timeout;
1212

13-
import tools.jackson.databind.DeserializationFeature;
1413
import tools.jackson.databind.ObjectReader;
14+
import tools.jackson.databind.cfg.DateTimeFeature;
1515
import tools.jackson.dataformat.ion.IonObjectMapper;
1616

1717
import static org.junit.jupiter.api.Assertions.*;
@@ -166,7 +166,7 @@ public void testDeserializationAsFloatEdgeCase11() throws Exception {
166166
public void testDeserializationAsInt01Nanoseconds() throws Exception {
167167
Instant expected = Instant.ofEpochSecond(0L);
168168
Instant actual = READER
169-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
169+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
170170
.readValue("0");
171171

172172
assertEquals(expected, actual, "The value is not correct.");
@@ -176,7 +176,7 @@ public void testDeserializationAsInt01Nanoseconds() throws Exception {
176176
public void testDeserializationAsInt02Nanoseconds() throws Exception {
177177
Instant expected = Instant.ofEpochSecond(123456789L);
178178
Instant actual = READER
179-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
179+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
180180
.readValue("123456789");
181181

182182
assertEquals(expected, actual, "The value is not correct.");
@@ -186,7 +186,7 @@ public void testDeserializationAsInt02Nanoseconds() throws Exception {
186186
public void testDeserializationAsInt03Nanoseconds() throws Exception {
187187
Instant expected = Instant.now().truncatedTo(ChronoUnit.SECONDS);
188188
Instant actual = READER
189-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
189+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
190190
.readValue(Long.toString(expected.getEpochSecond()));
191191

192192
assertEquals(expected, actual, "The value is not correct.");
@@ -196,7 +196,7 @@ public void testDeserializationAsInt03Nanoseconds() throws Exception {
196196
public void testDeserializationAsInt01Milliseconds() throws Exception {
197197
Instant expected = Instant.ofEpochSecond(0L);
198198
Instant actual = READER
199-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
199+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
200200
.readValue("0");
201201

202202
assertEquals(expected, actual, "The value is not correct.");
@@ -206,7 +206,7 @@ public void testDeserializationAsInt01Milliseconds() throws Exception {
206206
public void testDeserializationAsInt02Milliseconds() throws Exception {
207207
Instant expected = Instant.ofEpochSecond(123456789L, 422000000);
208208
Instant actual = READER
209-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
209+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
210210
.readValue("123456789422");
211211

212212
assertEquals(expected, actual, "The value is not correct.");
@@ -216,7 +216,7 @@ public void testDeserializationAsInt02Milliseconds() throws Exception {
216216
public void testDeserializationAsInt03Milliseconds() throws Exception {
217217
Instant expected = Instant.now().truncatedTo(ChronoUnit.MILLIS);
218218
Instant actual = READER
219-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
219+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
220220
.readValue(Long.toString(expected.toEpochMilli()));
221221

222222
assertEquals(expected, actual, "The value is not correct.");
@@ -262,7 +262,7 @@ public void testDeserializationAsIonTimestamp03() throws Exception {
262262
public void testDeserializationWithTypeInfo01() throws Exception {
263263
Instant expected = Instant.ofEpochSecond(123456789L, 183917322);
264264
IonObjectMapper m = newMapperBuilder()
265-
.enable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
265+
.enable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
266266
.addMixIn(Temporal.class, MockObjectConfiguration.class)
267267
.build();
268268

@@ -275,7 +275,7 @@ public void testDeserializationWithTypeInfo01() throws Exception {
275275
public void testDeserializationWithTypeInfo02() throws Exception {
276276
Instant expected = Instant.ofEpochSecond(123456789L, 0);
277277
IonObjectMapper m = newMapperBuilder()
278-
.enable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
278+
.enable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
279279
.addMixIn(Temporal.class, MockObjectConfiguration.class)
280280
.build();
281281

@@ -288,7 +288,7 @@ public void testDeserializationWithTypeInfo02() throws Exception {
288288
public void testDeserializationWithTypeInfo03() throws Exception {
289289
Instant expected = Instant.ofEpochSecond(123456789L, 422000000);
290290
IonObjectMapper m = newMapperBuilder()
291-
.disable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
291+
.disable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
292292
.addMixIn(Temporal.class, MockObjectConfiguration.class)
293293
.build();
294294

ion/src/test/java/tools/jackson/dataformat/ion/jsr310/IonTimestampOffsetDateTimeDeserializerTest.java

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
import org.junit.jupiter.api.Test;
1111

12-
import tools.jackson.databind.DeserializationFeature;
1312
import tools.jackson.databind.ObjectReader;
14-
13+
import tools.jackson.databind.cfg.DateTimeFeature;
1514
import tools.jackson.dataformat.ion.IonObjectMapper;
1615

1716
import static java.time.ZoneOffset.UTC;
@@ -97,7 +96,7 @@ public void testDeserializationAsFloat03NonUTCDefault() throws Exception {
9796
public void testDeserializationAsInt01Nanoseconds() throws Exception {
9897
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), UTC);
9998
OffsetDateTime actual = READER_UTC_DEFAULT
100-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
99+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
101100
.readValue("0");
102101

103102
assertEquals(expected, actual, "The value is not correct.");
@@ -107,7 +106,7 @@ public void testDeserializationAsInt01Nanoseconds() throws Exception {
107106
public void testDeserializationAsInt01NanosecondsNonUTCDefault() throws Exception {
108107
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), Z1);
109108
OffsetDateTime actual = READER_Z1_DEFAULT
110-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
109+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
111110
.readValue("0");
112111

113112
assertEquals(expected, actual, "The value is not correct.");
@@ -117,7 +116,7 @@ public void testDeserializationAsInt01NanosecondsNonUTCDefault() throws Exceptio
117116
public void testDeserializationAsInt02Nanoseconds() throws Exception {
118117
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L), UTC);
119118
OffsetDateTime actual = READER_UTC_DEFAULT
120-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
119+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
121120
.readValue("123456789");
122121

123122
assertEquals(expected, actual, "The value is not correct.");
@@ -127,7 +126,7 @@ public void testDeserializationAsInt02Nanoseconds() throws Exception {
127126
public void testDeserializationAsInt02NanosecondsNonUTCDefault() throws Exception {
128127
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L), Z1);
129128
OffsetDateTime actual = READER_Z1_DEFAULT
130-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
129+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
131130
.readValue("123456789");
132131

133132
assertEquals(expected, actual, "The value is not correct.");
@@ -138,7 +137,7 @@ public void testDeserializationAsInt03Nanoseconds() throws Exception {
138137
Instant now = Instant.now();
139138
OffsetDateTime expected = OffsetDateTime.ofInstant(now, UTC).truncatedTo(ChronoUnit.SECONDS);
140139
OffsetDateTime actual = READER_UTC_DEFAULT
141-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
140+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
142141
.readValue(Long.toString(now.getEpochSecond()));
143142

144143
assertEquals(expected, actual, "The value is not correct.");
@@ -149,7 +148,7 @@ public void testDeserializationAsInt03NanosecondsNonUTCDefault() throws Exceptio
149148
Instant now = Instant.now();
150149
OffsetDateTime expected = OffsetDateTime.ofInstant(now, Z1).truncatedTo(ChronoUnit.SECONDS);
151150
OffsetDateTime actual = READER_Z1_DEFAULT
152-
.with(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
151+
.with(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
153152
.readValue(Long.toString(now.getEpochSecond()));
154153

155154
assertEquals(expected, actual, "The value is not correct.");
@@ -159,7 +158,7 @@ public void testDeserializationAsInt03NanosecondsNonUTCDefault() throws Exceptio
159158
public void testDeserializationAsInt01Milliseconds() throws Exception {
160159
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), UTC);
161160
OffsetDateTime actual = READER_UTC_DEFAULT
162-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
161+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
163162
.readValue("0");
164163

165164
assertEquals(expected, actual, "The value is not correct.");
@@ -169,7 +168,7 @@ public void testDeserializationAsInt01Milliseconds() throws Exception {
169168
public void testDeserializationAsInt01MillisecondsNonUTCDefault() throws Exception {
170169
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(0L), Z1);
171170
OffsetDateTime actual = READER_Z1_DEFAULT
172-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
171+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
173172
.readValue("0");
174173

175174
assertEquals(expected, actual, "The value is not correct.");
@@ -179,7 +178,7 @@ public void testDeserializationAsInt01MillisecondsNonUTCDefault() throws Excepti
179178
public void testDeserializationAsInt02Milliseconds() throws Exception {
180179
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 422000000), UTC);
181180
OffsetDateTime actual = READER_UTC_DEFAULT
182-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
181+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
183182
.readValue("123456789422");
184183

185184
assertEquals(expected, actual, "The value is not correct.");
@@ -189,7 +188,7 @@ public void testDeserializationAsInt02Milliseconds() throws Exception {
189188
public void testDeserializationAsInt02MillisecondsNonUTCDefault() throws Exception {
190189
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 422000000), Z1);
191190
OffsetDateTime actual = READER_Z1_DEFAULT
192-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
191+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
193192
.readValue("123456789422");
194193

195194
assertEquals(expected, actual, "The value is not correct.");
@@ -200,7 +199,7 @@ public void testDeserializationAsInt03Milliseconds() throws Exception {
200199
Instant now = Instant.now();
201200
OffsetDateTime expected = OffsetDateTime.ofInstant(now, UTC).truncatedTo(ChronoUnit.MILLIS);
202201
OffsetDateTime actual = READER_UTC_DEFAULT
203-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
202+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
204203
.readValue(Long.toString(now.toEpochMilli()));
205204

206205
assertEquals(expected, actual, "The value is not correct.");
@@ -211,7 +210,7 @@ public void testDeserializationAsInt03MillisecondsNonUTCDefault() throws Excepti
211210
Instant now = Instant.now();
212211
OffsetDateTime expected = OffsetDateTime.ofInstant(now, Z1).truncatedTo(ChronoUnit.MILLIS);
213212
OffsetDateTime actual = READER_Z1_DEFAULT
214-
.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
213+
.without(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
215214
.readValue(Long.toString(now.toEpochMilli()));
216215

217216
assertEquals(expected, actual, "The value is not correct.");
@@ -298,7 +297,7 @@ public void testDeserializationWithTypeInfo01() throws Exception {
298297
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 183917322), UTC);
299298

300299
IonObjectMapper m = newMapperBuilder()
301-
.enable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
300+
.enable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
302301
.addMixIn(Temporal.class, MockObjectConfiguration.class)
303302
.build();
304303

@@ -313,7 +312,7 @@ public void testDeserializationWithTypeInfo01NonUTCDefault() throws Exception {
313312

314313
IonObjectMapper m = newMapperBuilder()
315314
.defaultTimeZone(TimeZone.getTimeZone(Z1))
316-
.enable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
315+
.enable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
317316
.addMixIn(Temporal.class, MockObjectConfiguration.class)
318317
.build();
319318

@@ -327,7 +326,7 @@ public void testDeserializationWithTypeInfo02() throws Exception {
327326
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 0), UTC);
328327

329328
IonObjectMapper m = newMapperBuilder()
330-
.enable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
329+
.enable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
331330
.addMixIn(Temporal.class, MockObjectConfiguration.class)
332331
.build();
333332

@@ -342,7 +341,7 @@ public void testDeserializationWithTypeInfo02NonUTCDefault() throws Exception {
342341

343342
IonObjectMapper m = newMapperBuilder()
344343
.defaultTimeZone(TimeZone.getTimeZone(Z1))
345-
.enable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
344+
.enable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
346345
.addMixIn(Temporal.class, MockObjectConfiguration.class)
347346
.build();
348347

@@ -356,7 +355,7 @@ public void testDeserializationWithTypeInfo03() throws Exception {
356355
OffsetDateTime expected = OffsetDateTime.ofInstant(Instant.ofEpochSecond(123456789L, 422000000), UTC);
357356

358357
IonObjectMapper m = newMapperBuilder()
359-
.disable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
358+
.disable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
360359
.addMixIn(Temporal.class, MockObjectConfiguration.class)
361360
.build();
362361

@@ -371,7 +370,7 @@ public void testDeserializationWithTypeInfo03NonUTCDefault() throws Exception {
371370

372371
IonObjectMapper m = newMapperBuilder()
373372
.defaultTimeZone(TimeZone.getTimeZone(Z1))
374-
.disable(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
373+
.disable(DateTimeFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)
375374
.addMixIn(Temporal.class, MockObjectConfiguration.class)
376375
.build();
377376

0 commit comments

Comments
 (0)