Results 1 to 2 of 2

Thread: SpEL and collections

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Default SpEL and collections

    For a class Foo that contains a list of Bar objects

    class Foo
    {
    List<Bar> bars;
    }

    class Bar
    {
    String str;
    }

    and for an SpEL expression of bars[0].str and attempting to set the string value, I am getting an UnsupportedOperationException because SpEL is setting the collection to an emptyList (I assume through Collections.emptyList).

    I have set the autoGrowCollections to true.

    How would one create a Bar object through SpEL that will allow it to set the value of a property?

    Thanks,
    Brian

  2. #2
    Join Date
    Jan 2010
    Posts
    2

    Default Ummm yeah

    I looked at the source code and didn't find anything that would assign an empty list. I took a look at my source code and I was too cute. I initialized the value to an emptyList for another purpose.

    In short, no problems here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •