@@ -246,7 +246,8 @@ else if (target instanceof Collection<?> collection) {
246
246
247
247
// Check for a custom IndexAccessor.
248
248
EvaluationContext evalContext = state .getEvaluationContext ();
249
- List <IndexAccessor > accessorsToTry = getIndexAccessorsToTry (target , evalContext .getIndexAccessors ());
249
+ List <IndexAccessor > accessorsToTry =
250
+ AstUtils .getAccessorsToTry (target , evalContext .getIndexAccessors ());
250
251
if (accessMode .supportsReads ) {
251
252
try {
252
253
for (IndexAccessor indexAccessor : accessorsToTry ) {
@@ -444,22 +445,6 @@ private static Class<?> getObjectType(Object obj) {
444
445
return (obj instanceof Class <?> clazz ? clazz : obj .getClass ());
445
446
}
446
447
447
- /**
448
- * Determine the set of index accessors that should be used to try to access
449
- * an index on the specified context object.
450
- * <p>Delegates to {@link AstUtils#getAccessorsToTry(Class, List)}.
451
- * @param targetObject the object upon which index access is being attempted
452
- * @param indexAccessors the list of index accessors to process
453
- * @return a list of accessors that should be tried in order to access the
454
- * index, or an empty list if no suitable accessor could be found
455
- */
456
- private static List <IndexAccessor > getIndexAccessorsToTry (
457
- @ Nullable Object targetObject , List <IndexAccessor > indexAccessors ) {
458
-
459
- Class <?> targetType = (targetObject != null ? targetObject .getClass () : null );
460
- return AstUtils .getAccessorsToTry (targetType , indexAccessors );
461
- }
462
-
463
448
464
449
/**
465
450
* Tracks state when the {@code Indexer} is being used as a {@link PropertyAccessor}.
@@ -740,8 +725,8 @@ public TypedValue getValue() {
740
725
// we need to reset our cached state.
741
726
Indexer .this .cachedPropertyReadState = null ;
742
727
}
743
- List <PropertyAccessor > accessorsToTry = AstUtils . getAccessorsToTry ( targetType ,
744
- this .evaluationContext .getPropertyAccessors ());
728
+ List <PropertyAccessor > accessorsToTry =
729
+ AstUtils . getAccessorsToTry ( targetType , this .evaluationContext .getPropertyAccessors ());
745
730
for (PropertyAccessor accessor : accessorsToTry ) {
746
731
if (accessor .canRead (this .evaluationContext , this .targetObject , this .name )) {
747
732
if (accessor instanceof ReflectivePropertyAccessor reflectivePropertyAccessor ) {
@@ -783,8 +768,8 @@ public void setValue(@Nullable Object newValue) {
783
768
// we need to reset our cached state.
784
769
Indexer .this .cachedPropertyWriteState = null ;
785
770
}
786
- List <PropertyAccessor > accessorsToTry = AstUtils . getAccessorsToTry ( targetType ,
787
- this .evaluationContext .getPropertyAccessors ());
771
+ List <PropertyAccessor > accessorsToTry =
772
+ AstUtils . getAccessorsToTry ( targetType , this .evaluationContext .getPropertyAccessors ());
788
773
for (PropertyAccessor accessor : accessorsToTry ) {
789
774
if (accessor .canWrite (this .evaluationContext , this .targetObject , this .name )) {
790
775
accessor .write (this .evaluationContext , this .targetObject , this .name , newValue );
@@ -998,7 +983,7 @@ public TypedValue getValue() {
998
983
Indexer .this .cachedIndexReadState = null ;
999
984
}
1000
985
List <IndexAccessor > accessorsToTry =
1001
- getIndexAccessorsToTry (this .target , this .evaluationContext .getIndexAccessors ());
986
+ AstUtils . getAccessorsToTry (this .target , this .evaluationContext .getIndexAccessors ());
1002
987
for (IndexAccessor indexAccessor : accessorsToTry ) {
1003
988
if (indexAccessor .canRead (this .evaluationContext , this .target , this .index )) {
1004
989
TypedValue result = indexAccessor .read (this .evaluationContext , this .target , this .index );
@@ -1050,7 +1035,7 @@ public void setValue(@Nullable Object newValue) {
1050
1035
Indexer .this .cachedIndexWriteState = null ;
1051
1036
}
1052
1037
List <IndexAccessor > accessorsToTry =
1053
- getIndexAccessorsToTry (this .target , this .evaluationContext .getIndexAccessors ());
1038
+ AstUtils . getAccessorsToTry (this .target , this .evaluationContext .getIndexAccessors ());
1054
1039
for (IndexAccessor indexAccessor : accessorsToTry ) {
1055
1040
if (indexAccessor .canWrite (this .evaluationContext , this .target , this .index )) {
1056
1041
indexAccessor .write (this .evaluationContext , this .target , this .index , newValue );
0 commit comments