@@ -85,7 +85,7 @@ public BeanPropertyMap renameAll(NameTransformer transformer)
85
85
}
86
86
87
87
protected abstract BeanPropertyMap _renameAll (NameTransformer transformer );
88
-
88
+
89
89
// Confining this case insensitivity to this function (and the find method) in case we want to
90
90
// apply a particular locale to the lower case function. For now, using the default.
91
91
protected final String getPropertyName (SettableBeanProperty prop ) {
@@ -276,11 +276,11 @@ protected Small(boolean caseInsensitive, int sz,
276
276
super (caseInsensitive );
277
277
size = sz ;
278
278
prop1 = p1 ;
279
- key1 = (p1 == null ) ? null : p1 . getName ( );
279
+ key1 = (p1 == null ) ? null : getPropertyName ( p1 );
280
280
prop2 = p2 ;
281
- key2 = (p2 == null ) ? null : p2 . getName ( );
281
+ key2 = (p2 == null ) ? null : getPropertyName ( p2 );
282
282
prop3 = p3 ;
283
- key3 = (p3 == null ) ? null : p3 . getName ( );
283
+ key3 = (p3 == null ) ? null : getPropertyName ( p3 );
284
284
}
285
285
286
286
@ Override
@@ -298,7 +298,7 @@ protected BeanPropertyMap _renameAll(NameTransformer transformer)
298
298
@ Override
299
299
public BeanPropertyMap withProperty (SettableBeanProperty prop )
300
300
{
301
- final String key = prop . getName ( );
301
+ final String key = getPropertyName ( prop );
302
302
// First: replace existing one?
303
303
switch (size ) {
304
304
case 3 :
@@ -390,6 +390,9 @@ public int size() {
390
390
391
391
@ Override
392
392
public SettableBeanProperty find (String key ) {
393
+ if (_caseInsensitive ) {
394
+ key = key .toLowerCase ();
395
+ }
393
396
if (key == key1 ) return prop1 ;
394
397
if (key == key2 ) return prop2 ;
395
398
if (key == key3 ) return prop3 ;
@@ -543,6 +546,7 @@ protected void init(Collection<SettableBeanProperty> props)
543
546
}
544
547
545
548
String key = getPropertyName (prop );
549
+ // int slot = _hashCode(key);
546
550
int slot = key .hashCode () & _hashMask ;
547
551
548
552
// primary slot not free?
@@ -559,15 +563,16 @@ protected void init(Collection<SettableBeanProperty> props)
559
563
}
560
564
}
561
565
}
562
- //System.err.println(" add '"+key+" at #"+slot+" (hashed at "+(key.hashCode() & _hashMask )+")");
566
+ //System.err.println(" add '"+key+" at #"+slot+"/"+size+" (hashed at "+_hashCode (key)+")");
563
567
keys [slot ] = key ;
564
568
propHash [slot ] = prop ;
565
569
}
566
- /*
570
+ /*
567
571
for (int i = 0; i < keys.length; ++i) {
568
572
System.err.printf("#%02d: %s\n", i, (keys[i] == null) ? "-" : keys[i]);
569
573
}
570
574
*/
575
+
571
576
_keys = keys ;
572
577
_propsHash = propHash ;
573
578
_spillCount = spills ;
@@ -625,7 +630,9 @@ public BeanPropertyMap withProperty(SettableBeanProperty newProp)
625
630
}
626
631
// If not, append
627
632
633
+ // int slot = _hashCode(key);
628
634
int slot = key .hashCode () & _hashMask ;
635
+
629
636
int hashSize = _hashMask +1 ;
630
637
631
638
// primary slot not free?
@@ -753,6 +760,7 @@ public SettableBeanProperty find(String key)
753
760
if (_caseInsensitive ) {
754
761
key = key .toLowerCase ();
755
762
}
763
+ // int slot = _hashCode(key);
756
764
int slot = key .hashCode () & _hashMask ;
757
765
String match = _keys [slot ];
758
766
if ((match == key ) || key .equals (match )) {
@@ -807,5 +815,13 @@ private int _findFromOrdered(SettableBeanProperty prop) {
807
815
}
808
816
throw new IllegalStateException ("Illegal state: property '" +prop .getName ()+"' missing from _propsInOrder" );
809
817
}
818
+
819
+ /*
820
+ private final int _hashCode(String key) {
821
+ int h = key.hashCode();
822
+ h ^= h >> 13;
823
+ return h & _hashMask;
824
+ }
825
+ */
810
826
}
811
827
}
0 commit comments