File tree 1 file changed +30
-0
lines changed
src/test/java/com/fasterxml/jackson/databind/ser
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,28 @@ public GG second() {
370
370
}
371
371
}
372
372
373
+ public static class SimpleWrapper <T > {
374
+
375
+ private final T value ;
376
+
377
+ SimpleWrapper (T value ) {
378
+ this .value = value ;
379
+ }
380
+
381
+ @ JsonCreator (mode = JsonCreator .Mode .DELEGATING )
382
+ public static <T > SimpleWrapper <T > fromJson (JsonSimpleWrapper <T > value ) {
383
+ return new SimpleWrapper <>(value .object );
384
+ }
385
+ }
386
+
387
+ @ JsonDeserialize
388
+ public static final class JsonSimpleWrapper <T > {
389
+
390
+ @ JsonProperty ("object" )
391
+ public T object ;
392
+
393
+ }
394
+
373
395
/*
374
396
/**********************************************************
375
397
/* Unit tests
@@ -521,4 +543,12 @@ public void testStaticDelegateDeserialization_wildcardInResult() throws Exceptio
521
543
Account account2 = wrapper .second ();
522
544
assertEquals (new Account ("name2" , 2L ), account2 );
523
545
}
546
+
547
+ public void testSimpleStaticJsonCreator () throws Exception
548
+ {
549
+ SimpleWrapper <Account > wrapper = MAPPER .readValue ("{\" object\" :{\" id\" :1,\" name\" :\" name1\" }}" ,
550
+ new TypeReference <SimpleWrapper <Account >>() {});
551
+ Account account = wrapper .value ;
552
+ assertEquals (new Account ("name1" , 1L ), account );
553
+ }
524
554
}
You can’t perform that action at this time.
0 commit comments