@@ -26,7 +26,7 @@ public class BuilderBasedDeserializer
26
26
private static final long serialVersionUID = 1L ;
27
27
28
28
protected final AnnotatedMethod _buildMethod ;
29
-
29
+
30
30
/*
31
31
/**********************************************************
32
32
/* Life-cycle, construction, initialization
@@ -66,7 +66,7 @@ protected BuilderBasedDeserializer(BuilderBasedDeserializer src, boolean ignoreA
66
66
super (src , ignoreAllUnknown );
67
67
_buildMethod = src ._buildMethod ;
68
68
}
69
-
69
+
70
70
protected BuilderBasedDeserializer (BuilderBasedDeserializer src , NameTransformer unwrapper ) {
71
71
super (src , unwrapper );
72
72
_buildMethod = src ._buildMethod ;
@@ -86,7 +86,7 @@ public BuilderBasedDeserializer(BuilderBasedDeserializer src, BeanPropertyMap pr
86
86
super (src , props );
87
87
_buildMethod = src ._buildMethod ;
88
88
}
89
-
89
+
90
90
@ Override
91
91
public JsonDeserializer <Object > unwrappingDeserializer (NameTransformer unwrapper )
92
92
{
@@ -117,13 +117,13 @@ protected BeanDeserializerBase asArrayDeserializer() {
117
117
SettableBeanProperty [] props = _beanProperties .getPropertiesInInsertionOrder ();
118
118
return new BeanAsArrayBuilderDeserializer (this , props , _buildMethod );
119
119
}
120
-
120
+
121
121
/*
122
122
/**********************************************************
123
123
/* JsonDeserializer implementation
124
124
/**********************************************************
125
125
*/
126
-
126
+
127
127
protected final Object finishBuild (DeserializationContext ctxt , Object builder )
128
128
throws IOException
129
129
{
@@ -137,7 +137,7 @@ protected final Object finishBuild(DeserializationContext ctxt, Object builder)
137
137
return wrapInstantiationProblem (e , ctxt );
138
138
}
139
139
}
140
-
140
+
141
141
/**
142
142
* Main deserialization method for bean-based objects (POJOs).
143
143
*/
@@ -146,7 +146,7 @@ public final Object deserialize(JsonParser p, DeserializationContext ctxt)
146
146
throws IOException
147
147
{
148
148
JsonToken t = p .getCurrentToken ();
149
-
149
+
150
150
// common case first:
151
151
if (t == JsonToken .START_OBJECT ) {
152
152
t = p .nextToken ();
@@ -197,7 +197,7 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt,
197
197
*/
198
198
return finishBuild (ctxt , _deserialize (p , ctxt , builder ));
199
199
}
200
-
200
+
201
201
/*
202
202
/**********************************************************
203
203
/* Concrete deserialization methods
@@ -207,7 +207,7 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt,
207
207
protected final Object _deserialize (JsonParser p ,
208
208
DeserializationContext ctxt , Object builder )
209
209
throws IOException , JsonProcessingException
210
- {
210
+ {
211
211
if (_injectables != null ) {
212
212
injectValues (ctxt , builder );
213
213
}
@@ -233,7 +233,7 @@ protected final Object _deserialize(JsonParser p,
233
233
// Skip field name:
234
234
p .nextToken ();
235
235
SettableBeanProperty prop = _beanProperties .find (propName );
236
-
236
+
237
237
if (prop != null ) { // normal case
238
238
try {
239
239
builder = prop .deserializeSetAndReturn (p , ctxt , builder );
@@ -246,7 +246,7 @@ protected final Object _deserialize(JsonParser p,
246
246
}
247
247
return builder ;
248
248
}
249
-
249
+
250
250
/**
251
251
* Streamlined version that is only used when no "special"
252
252
* features are enabled.
@@ -323,7 +323,7 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt)
323
323
* Method called to deserialize bean using "property-based creator":
324
324
* this means that a non-default constructor or factory method is
325
325
* called, and then possibly other setters. The trick is that
326
- * values for creator method need to be buffered, first; and
326
+ * values for creator method need to be buffered, first; and
327
327
* due to non-guaranteed ordering possibly some other properties
328
328
* as well.
329
329
*/
@@ -332,7 +332,7 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt)
332
332
protected final Object _deserializeUsingPropertyBased (final JsonParser p ,
333
333
final DeserializationContext ctxt )
334
334
throws IOException , JsonProcessingException
335
- {
335
+ {
336
336
final PropertyBasedCreator creator = _propertyBasedCreator ;
337
337
PropertyValueBuffer buffer = creator .startBuilding (p , ctxt , _objectIdReader );
338
338
@@ -414,13 +414,13 @@ protected final Object _deserializeUsingPropertyBased(final JsonParser p,
414
414
}
415
415
return bean ;
416
416
}
417
-
417
+
418
418
/*
419
419
/**********************************************************
420
420
/* Deserializing when we have to consider an active View
421
421
/**********************************************************
422
422
*/
423
-
423
+
424
424
protected final Object deserializeWithView (JsonParser p , DeserializationContext ctxt ,
425
425
Object bean , Class <?> activeView )
426
426
throws IOException , JsonProcessingException
@@ -447,7 +447,7 @@ protected final Object deserializeWithView(JsonParser p, DeserializationContext
447
447
}
448
448
return bean ;
449
449
}
450
-
450
+
451
451
/*
452
452
/**********************************************************
453
453
/* Handling for cases where we have "unwrapped" values
@@ -477,7 +477,7 @@ protected Object deserializeWithUnwrapped(JsonParser p, DeserializationContext c
477
477
}
478
478
479
479
final Class <?> activeView = _needViewProcesing ? ctxt .getActiveView () : null ;
480
-
480
+
481
481
for (; p .getCurrentToken () != JsonToken .END_OBJECT ; p .nextToken ()) {
482
482
String propName = p .getCurrentName ();
483
483
p .nextToken ();
@@ -515,7 +515,7 @@ protected Object deserializeWithUnwrapped(JsonParser p, DeserializationContext c
515
515
tokens .writeEndObject ();
516
516
_unwrappedPropertyHandler .processUnwrapped (p , ctxt , bean , tokens );
517
517
return bean ;
518
- }
518
+ }
519
519
520
520
@ SuppressWarnings ("resource" )
521
521
protected Object deserializeWithUnwrapped (JsonParser p ,
@@ -580,31 +580,7 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p,
580
580
// creator property?
581
581
SettableBeanProperty creatorProp = creator .findCreatorProperty (propName );
582
582
if (creatorProp != null ) {
583
- // Last creator property to set?
584
- if (buffer .assignParameter (creatorProp , creatorProp .deserialize (p , ctxt ))) {
585
- t = p .nextToken (); // to move to following FIELD_NAME/END_OBJECT
586
- Object bean ;
587
- try {
588
- bean = creator .build (ctxt , buffer );
589
- } catch (Exception e ) {
590
- wrapAndThrow (e , _beanType .getRawClass (), propName , ctxt );
591
- continue ; // never gets here
592
- }
593
- // if so, need to copy all remaining tokens into buffer
594
- while (t == JsonToken .FIELD_NAME ) {
595
- p .nextToken (); // to skip name
596
- tokens .copyCurrentStructure (p );
597
- t = p .nextToken ();
598
- }
599
- tokens .writeEndObject ();
600
- if (bean .getClass () != _beanType .getRawClass ()) {
601
- // !!! 08-Jul-2011, tatu: Could probably support; but for now
602
- // it's too complicated, so bail out
603
- ctxt .reportMappingException ("Can not create polymorphic instances with unwrapped values" );
604
- return null ;
605
- }
606
- return _unwrappedPropertyHandler .processUnwrapped (p , ctxt , bean , tokens );
607
- }
583
+ buffer .assignParameter (creatorProp , creatorProp .deserialize (p , ctxt ));
608
584
continue ;
609
585
}
610
586
// Object Id property?
@@ -646,7 +622,7 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p,
646
622
/* external type id
647
623
/**********************************************************
648
624
*/
649
-
625
+
650
626
protected Object deserializeWithExternalTypeId (JsonParser p , DeserializationContext ctxt )
651
627
throws IOException , JsonProcessingException
652
628
{
@@ -699,15 +675,14 @@ protected Object deserializeWithExternalTypeId(JsonParser p,
699
675
} catch (Exception e ) {
700
676
wrapAndThrow (e , bean , propName , ctxt );
701
677
}
702
- continue ;
703
678
} else {
704
679
// Unknown: let's call handler method
705
- handleUnknownProperty (p , ctxt , bean , propName );
680
+ handleUnknownProperty (p , ctxt , bean , propName );
706
681
}
707
682
}
708
683
// and when we get this far, let's try finalizing the deal:
709
684
return ext .complete (p , ctxt , bean );
710
- }
685
+ }
711
686
712
687
protected Object deserializeUsingPropertyBasedWithExternalTypeId (JsonParser p ,
713
688
DeserializationContext ctxt )
0 commit comments