@@ -478,18 +478,23 @@ public void resolve(DeserializationContext ctxt)
478
478
prop = _resolvedObjectIdProperty (ctxt , prop );
479
479
}
480
480
// Support unwrapped values (via @JsonUnwrapped)
481
- SettableBeanProperty u = _resolveUnwrappedProperty (ctxt , prop );
482
- if (u != null ) {
483
- prop = u ;
484
- if (unwrapped == null ) {
485
- unwrapped = new UnwrappedPropertyHandler ();
481
+ NameTransformer xform = _findPropertyUnwrapper (ctxt , prop );
482
+ if (xform != null ) {
483
+ JsonDeserializer <Object > orig = prop .getValueDeserializer ();
484
+ JsonDeserializer <Object > unwrapping = orig .unwrappingDeserializer (xform );
485
+ if (unwrapping != orig && unwrapping != null ) {
486
+ prop = prop .withValueDeserializer (unwrapping );
487
+ if (unwrapped == null ) {
488
+ unwrapped = new UnwrappedPropertyHandler ();
489
+ }
490
+ unwrapped .addProperty (prop );
491
+ // 12-Dec-2014, tatu: As per [databind#647], we will have problems if
492
+ // the original property is left in place. So let's remove it now.
493
+ // 25-Mar-2017, tatu: Wonder if this could be problematic wrt creators?
494
+ // (that is, should be remove it from creator too)
495
+ _beanProperties .remove (prop );
496
+ continue ;
486
497
}
487
- unwrapped .addProperty (prop );
488
- // 12-Dec-2014, tatu: As per [databind#647], we will have problems if
489
- // the original property is left in place. So let's remove it now.
490
- // 25-Mar-2017, tatu: Wonder if this could be problematic wrt creators?
491
- _beanProperties .remove (prop );
492
- continue ;
493
498
}
494
499
495
500
// 26-Oct-2016, tatu: Need to have access to value deserializer to know if
@@ -796,7 +801,7 @@ protected SettableBeanProperty _resolvedObjectIdProperty(DeserializationContext
796
801
* Helper method called to see if given property might be so-called unwrapped
797
802
* property: these require special handling.
798
803
*/
799
- protected SettableBeanProperty _resolveUnwrappedProperty (DeserializationContext ctxt ,
804
+ protected NameTransformer _findPropertyUnwrapper (DeserializationContext ctxt ,
800
805
SettableBeanProperty prop )
801
806
throws JsonMappingException
802
807
{
@@ -811,13 +816,7 @@ protected SettableBeanProperty _resolveUnwrappedProperty(DeserializationContext
811
816
"Can not define Creator property \" %s\" as `@JsonUnwrapped`: combination not yet supported" ,
812
817
prop .getName ()));
813
818
}
814
-
815
- JsonDeserializer <Object > orig = prop .getValueDeserializer ();
816
- JsonDeserializer <Object > unwrapping = orig .unwrappingDeserializer (unwrapper );
817
- if (unwrapping != orig && unwrapping != null ) {
818
- // might be cleaner to create new instance; but difficult to do reliably, so:
819
- return prop .withValueDeserializer (unwrapping );
820
- }
819
+ return unwrapper ;
821
820
}
822
821
}
823
822
return null ;
0 commit comments