pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edvin Syse <ed...@sysedata.no>
Subject Re: No support for Map in BeanAdapter?
Date Wed, 22 Jun 2011 22:12:04 GMT
Den 22.06.2011 23:58, skrev Greg Brown:
> Ah, I see. java.util.Map is not supported. You need to use the Pivot collections with
BeanAdapter. Did you try wrapping your map in a MapAdapter (or simply using a Pivot Map such
as HashMap)?

I don't see how I can possibly do that, since I can't (and shouldn't) 
change the domain object to hold an instance of Pivot Map. Example 
domain object:

public class Person {
	String name;
	java.util.Map properties = new java.util.HashMap();
}

So I have a list of these set as the tableData for a TableView. Each 
Person contains another map inside properties, and I want to retrieve a 
value from that map to show in the TableView. Here is how one could 
manually construct one of the Person objects:

Person p = new Person();
p.name = "John Doe"

java.util.Map data = new java.util.HashMap();
data.put("group", "My Group")

p.properties.put("data", "data")

My column is:

<TableView.Column name="data.group"/>

I can't see how I can make this work without using an intermediary 
domain object, or simply adding support for java.util.Map to BeanAdapter.

Do you think adding support for java.util.Map to BeanAdapter has little 
value?

By the way, the patch is trivial, and it works great :)

-- Edvin

Mime
View raw message