You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All features is supported using the reflection mode, just slower, but still faster than existing solutions. Here is a quick benchmark of simple object field binding:
@@ -230,7 +228,6 @@ The final step is to switch mode
230
228
231
229
```java
232
230
JsonIterator.setMode(DecodingMode.STATIC_MODE); // set mode before using
233
-
JsoniterAnnotationSupport.enable();
234
231
JsonIterator.deserialize(...
235
232
```
236
233
@@ -320,13 +317,7 @@ public class TestObject {
320
317
321
318
**binding**
322
319
323
-
mark the classwith jsoniter annotation, then enable annotation support. Or if you are already using jackson, you can still use jackson annotation, just turn on JacksonAnnotationSupport. It is important to mark `@JsonProperty` with field name, as old java version can not get parameter name by reflection.
324
-
325
-
```java
326
-
JacksonAnnotationSupport.enable(); // use JsoniterAnnotationSupport if you are not using Jackson
327
-
return iter.read(TestObject.class);
328
-
```
329
-
320
+
It is important to mark `@JsonProperty` with field name, as old java version can not get parameter name by reflection.
330
321
Not only constructor binding is supported, static method working as factory method is also supported. Just mark it with `@JsonCreator`.
331
322
332
323
## SetterBinding
@@ -372,7 +363,6 @@ public static class TestObject {
372
363
```
373
364
374
365
```java
375
-
JsoniterAnnotationSupport.enable();
376
366
return iter.read(TestObject.class);
377
367
```
378
368
@@ -515,7 +505,6 @@ public static class TestObject {
515
505
if `field1` is not present in the input json, exception will be thrown.
516
506
517
507
```java
518
-
JsoniterAnnotationSupport.enable();
519
508
JsonIterator iter =JsonIterator.parse("{'field2':101}".replace('\'', '"'));
520
509
return iter.read(TestObject.class);
521
510
```
@@ -560,7 +549,6 @@ public static class TestObject2 {
560
549
using `asExtraForUnknownProperties` we can detect if the input has extra fields. Enable the annotation support:
561
550
562
551
```java
563
-
JsoniterAnnotationSupport.enable();
564
552
JsonItertor iter =JsonIterator.parse("{'field1':101,'field2':101,'field3':101}".replace('\'', '"').getBytes());
0 commit comments