Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Map XMLChoiceCollectionMapping to a Map



You could handle this case with a custom attribute accessor that just returns the values() from the Map on the getAttributeValueFromObject and manually builds the map from the list on setAttributeValueInObject.

I changed the ArrayList attribute to a Multimap (http://guava-libraries.googlecode.com/svn/tags/release09/javadoc/com/google/common/collect/Multimap.html) and added moxy specific setters to set and get this multimap as a list. This works just fine, it's even a better solution since I get a multimap and not a map.

A minor thing, at first I removed

add.setAttributeName("nya");

since I added

add.setSetMethodName("setNya");
add.setGetMethodName("getNya");

but then I got a stacktrace. It seems as if the attribute name needs to be there even though I use a getter/setter, and even though the type of the attribute is domething totally different than the useCollectionClass type?

--

  /Magnus Heino

Back to the top