Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpEL: support for inline list expressions [SPR-7335] #11994

Closed
spring-projects-issues opened this issue Jun 29, 2010 · 1 comment
Closed

SpEL: support for inline list expressions [SPR-7335] #11994

spring-projects-issues opened this issue Jun 29, 2010 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Andy Clement opened SPR-7335 and commented

This is a feature that is repeatedly requested in emails to me. I'm planning to reactivate (the previously written then removed) inline list support. At the moment users are having to make calls out to the Arrays type to build lists, eg.

T(java.util.Arrays).asList(1,2,3)

this will be very expensive (method invocation every time) compared to something like this

{1,2,3}

which, if expression evaluation is smart, will result in a single immutable constant list (of type ArrayList). Following on from that we can build the array construction syntax:

new int[]{1,2,3}

If you read this Juergen, are you ok with adding it?


Affects: 3.0.3

Referenced from: commits f5ced9b

@spring-projects-issues
Copy link
Collaborator Author

Andy Clement commented

Support is in.

Basic lists work: "{1,2,3}" "{'abc','def'}"
nested lists work: "1,2},{3,4"
Basic arrays work: "new int[3]"
Arrays with initializers work: "new int[]{1,2,3}"
Conversion works for array initializer values: "new String[]{1,2,3}" - numbers are converted to strings
multi dimensional arrays are supported unless initializers are used, so "new int[5][10]" works but "new int[][]1,2},{3,4" will give an error indicating a current restriction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants