Spring Expression - Array construction
Array construction
Arrays can be built using the familiar Java syntax, optionally supplying an initializer to have the array populated at construction time.
int[] numbers1 = (int[]) parser.parseExpression("new int[4]").getValue(context);
// Array with initializer
int[] numbers2 = (int[]) parser.parseExpression("new int[]{1,2,3}").getValue(context);
// Multi dimensional array
int[][] numbers3 = (int[][]) parser.parseExpression("new int[4][5]").getValue(context);
It is not currently allowed to supply an initializer when constructing a multi-dimensional array
Comments
Post a Comment