@@ -32,6 +32,7 @@ public class JavaBeanDeserializer implements ObjectDeserializer {
32
32
private ConcurrentMap <String , Object > extraFieldDeserializers ;
33
33
34
34
private final Map <String , FieldDeserializer > alterNameFieldDeserializers ;
35
+ private Map <String , FieldDeserializer > fieldDeserializerMap ;
35
36
36
37
private transient long [] smartMatchHashArray ;
37
38
private transient short [] smartMatchHashArrayMapping ;
@@ -61,6 +62,13 @@ public JavaBeanDeserializer(ParserConfig config, JavaBeanInfo beanInfo){
61
62
62
63
sortedFieldDeserializers [i ] = fieldDeserializer ;
63
64
65
+ if (size > 128 ) {
66
+ if (fieldDeserializerMap == null ) {
67
+ fieldDeserializerMap = new HashMap <String , FieldDeserializer >();
68
+ }
69
+ fieldDeserializerMap .put (fieldInfo .name , fieldDeserializer );
70
+ }
71
+
64
72
for (String name : fieldInfo .alternateNames ) {
65
73
if (alterNameFieldDeserializers == null ) {
66
74
alterNameFieldDeserializers = new HashMap <String , FieldDeserializer >();
@@ -86,6 +94,13 @@ public FieldDeserializer getFieldDeserializer(String key, int[] setFlags) {
86
94
if (key == null ) {
87
95
return null ;
88
96
}
97
+
98
+ if (fieldDeserializerMap != null ) {
99
+ FieldDeserializer fieldDeserializer = fieldDeserializerMap .get (key );
100
+ if (fieldDeserializer != null ) {
101
+ return fieldDeserializer ;
102
+ }
103
+ }
89
104
90
105
int low = 0 ;
91
106
int high = sortedFieldDeserializers .length - 1 ;
@@ -479,14 +494,14 @@ protected <T> T deserialze(DefaultJSONParser parser, //
479
494
}
480
495
481
496
String typeKey = beanInfo .typeKey ;
482
- for (int fieldIndex = 0 ;; fieldIndex ++) {
497
+ for (int fieldIndex = 0 , notMatchCount = 0 ;; fieldIndex ++) {
483
498
String key = null ;
484
499
FieldDeserializer fieldDeser = null ;
485
500
FieldInfo fieldInfo = null ;
486
501
Class <?> fieldClass = null ;
487
502
JSONField feildAnnotation = null ;
488
503
boolean customDeserilizer = false ;
489
- if (fieldIndex < sortedFieldDeserializers .length ) {
504
+ if (fieldIndex < sortedFieldDeserializers .length && notMatchCount < 16 ) {
490
505
fieldDeser = sortedFieldDeserializers [fieldIndex ];
491
506
fieldInfo = fieldDeser .fieldInfo ;
492
507
fieldClass = fieldInfo .fieldClass ;
@@ -516,7 +531,8 @@ protected <T> T deserialze(DefaultJSONParser parser, //
516
531
matchField = true ;
517
532
valueParsed = true ;
518
533
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
519
- continue ;
534
+ notMatchCount ++;
535
+ continue ;
520
536
}
521
537
} else if (fieldClass == long .class || fieldClass == Long .class ) {
522
538
long longVal = lexer .scanFieldLong (name_chars );
@@ -530,7 +546,8 @@ protected <T> T deserialze(DefaultJSONParser parser, //
530
546
matchField = true ;
531
547
valueParsed = true ;
532
548
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
533
- continue ;
549
+ notMatchCount ++;
550
+ continue ;
534
551
}
535
552
} else if (fieldClass == String .class ) {
536
553
fieldValue = lexer .scanFieldString (name_chars );
@@ -539,7 +556,8 @@ protected <T> T deserialze(DefaultJSONParser parser, //
539
556
matchField = true ;
540
557
valueParsed = true ;
541
558
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
542
- continue ;
559
+ notMatchCount ++;
560
+ continue ;
543
561
}
544
562
} else if (fieldClass == java .util .Date .class && fieldInfo .format == null ) {
545
563
fieldValue = lexer .scanFieldDate (name_chars );
@@ -548,6 +566,7 @@ protected <T> T deserialze(DefaultJSONParser parser, //
548
566
matchField = true ;
549
567
valueParsed = true ;
550
568
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
569
+ notMatchCount ++;
551
570
continue ;
552
571
}
553
572
} else if (fieldClass == BigDecimal .class ) {
@@ -557,6 +576,7 @@ protected <T> T deserialze(DefaultJSONParser parser, //
557
576
matchField = true ;
558
577
valueParsed = true ;
559
578
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
579
+ notMatchCount ++;
560
580
continue ;
561
581
}
562
582
} else if (fieldClass == BigInteger .class ) {
@@ -566,6 +586,7 @@ protected <T> T deserialze(DefaultJSONParser parser, //
566
586
matchField = true ;
567
587
valueParsed = true ;
568
588
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
589
+ notMatchCount ++;
569
590
continue ;
570
591
}
571
592
} else if (fieldClass == boolean .class || fieldClass == Boolean .class ) {
@@ -581,7 +602,8 @@ protected <T> T deserialze(DefaultJSONParser parser, //
581
602
matchField = true ;
582
603
valueParsed = true ;
583
604
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
584
- continue ;
605
+ notMatchCount ++;
606
+ continue ;
585
607
}
586
608
} else if (fieldClass == float .class || fieldClass == Float .class ) {
587
609
float floatVal = lexer .scanFieldFloat (name_chars );
@@ -595,7 +617,8 @@ protected <T> T deserialze(DefaultJSONParser parser, //
595
617
matchField = true ;
596
618
valueParsed = true ;
597
619
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
598
- continue ;
620
+ notMatchCount ++;
621
+ continue ;
599
622
}
600
623
} else if (fieldClass == double .class || fieldClass == Double .class ) {
601
624
double doubleVal = lexer .scanFieldDouble (name_chars );
@@ -609,7 +632,8 @@ protected <T> T deserialze(DefaultJSONParser parser, //
609
632
matchField = true ;
610
633
valueParsed = true ;
611
634
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
612
- continue ;
635
+ notMatchCount ++;
636
+ continue ;
613
637
}
614
638
} else if (fieldClass .isEnum () //
615
639
&& parser .getConfig ().getDeserializer (fieldClass ) instanceof EnumDeserializer
@@ -623,6 +647,7 @@ protected <T> T deserialze(DefaultJSONParser parser, //
623
647
matchField = true ;
624
648
valueParsed = true ;
625
649
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
650
+ notMatchCount ++;
626
651
continue ;
627
652
}
628
653
}
@@ -633,6 +658,7 @@ protected <T> T deserialze(DefaultJSONParser parser, //
633
658
matchField = true ;
634
659
valueParsed = true ;
635
660
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
661
+ notMatchCount ++;
636
662
continue ;
637
663
}
638
664
} else if (fieldClass == float [].class ) {
@@ -642,6 +668,7 @@ protected <T> T deserialze(DefaultJSONParser parser, //
642
668
matchField = true ;
643
669
valueParsed = true ;
644
670
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
671
+ notMatchCount ++;
645
672
continue ;
646
673
}
647
674
} else if (fieldClass == float [][].class ) {
@@ -651,6 +678,7 @@ protected <T> T deserialze(DefaultJSONParser parser, //
651
678
matchField = true ;
652
679
valueParsed = true ;
653
680
} else if (lexer .matchStat == JSONLexer .NOT_MATCH_NAME ) {
681
+ notMatchCount ++;
654
682
continue ;
655
683
}
656
684
} else if (lexer .matchField (name_chars )) {
0 commit comments