24
24
import java .util .Collection ;
25
25
import java .util .List ;
26
26
import java .util .Map ;
27
- import java .util .StringJoiner ;
28
27
import java .util .function .Supplier ;
29
28
30
29
import org .springframework .asm .MethodVisitor ;
54
53
* @author Sam Brannen
55
54
* @since 3.0
56
55
*/
57
- // TODO support multidimensional arrays
58
- // TODO support correct syntax for multidimensional [][][] and not [,,,]
59
56
public class Indexer extends SpelNodeImpl {
60
57
61
58
private enum IndexedType {ARRAY , LIST , MAP , STRING , OBJECT }
@@ -185,7 +182,6 @@ else if (target instanceof Collection<?> collection) {
185
182
}
186
183
187
184
// Try and treat the index value as a property of the context object
188
- // TODO Could call the conversion service to convert the value to a String
189
185
TypeDescriptor valueType = indexValue .getTypeDescriptor ();
190
186
if (valueType != null && String .class == valueType .getType ()) {
191
187
this .indexedType = IndexedType .OBJECT ;
@@ -209,7 +205,7 @@ else if (this.indexedType == IndexedType.MAP) {
209
205
return (this .children [0 ] instanceof PropertyOrFieldReference || this .children [0 ].isCompilable ());
210
206
}
211
207
else if (this .indexedType == IndexedType .OBJECT ) {
212
- // If the string name is changing the accessor is clearly going to change (so no compilation possible)
208
+ // If the string name is changing, the accessor is clearly going to change (so no compilation possible)
213
209
return (this .cachedReadAccessor != null &&
214
210
this .cachedReadAccessor instanceof ReflectivePropertyAccessor .OptimalPropertyAccessor &&
215
211
getChild (0 ) instanceof StringLiteral );
@@ -326,12 +322,7 @@ else if (this.indexedType == IndexedType.OBJECT) {
326
322
327
323
@ Override
328
324
public String toStringAST () {
329
- // TODO Since we do not support multidimensional arrays, we should be able to return: "[" + getChild(0).toStringAST() + "]"
330
- StringJoiner sj = new StringJoiner ("," , "[" , "]" );
331
- for (int i = 0 ; i < getChildCount (); i ++) {
332
- sj .add (getChild (i ).toStringAST ());
333
- }
334
- return sj .toString ();
325
+ return "[" + getChild (0 ).toStringAST () + "]" ;
335
326
}
336
327
337
328
0 commit comments