• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ListOrderedMap

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another issue we came across that I am hoping someone has a solution for.

We are converting our java domain objects to groovy.

In one class we have a property that is of type ListOrderedMap which has

List<Integer, Map.Entry><Integer, String>

Now in our code we do a get(Integer) to return the corresponding Map.Entry

Then we call .value() on it to get the String.

The problem is that Groovy isn't returning the Map.Entry in the get, but instead an Integer object instead and tries to call getValue() on it which that method doesn't exist on an Integer object.

Anyone have this happen to them before and have a solution?

Thanks

Mark
 
Rj Salicco
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering what you were trying to do. Do you have some more code? I was playing around with:

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We were trying to have the get() method return the Map.Entry object since that was the correct type from the get method. But instead it kept returning an int.

Based on stuff that gets generated it appears that the getMetaClass for that call was trying to return the wrong type (int), which we then try to cast to Map.Entry because that is what was expected.

Our solution was to get rid of all of our ListOrderedMap into other collection classes.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic