OptionGroup + multiselect + List


I’m struggling to find the best way of binding a java.util.list to an OptionGroup
with multiselect set to true.

I’m binding a Bean to a Form. Let’s say Person using a BeanItem.
That Person bean has a List of Contacts.

public class Person {

	String name;
	List<Contact> contacts = new ArrayList<Contact>();
	public String getName() {
		return name;
	public void setName(String name) {
		this.name = name;
	public List<Contact> getContacts() {
		return contacts;
	public void setContacts(List<Contact> contacts) {
		this.contacts = contacts;

class Contact{
	String number;

	public String getNumber() {
		return number;

	public void setNumber(String number) {
		this.number = number;

I’m giving the OptionGroup a list of contacts to choose from;

OptionGroup og = new OptionGroup("allContacts",allContacts);

The OptionGroup shows correctly which Items are selected by evaluating the

The problem I have now occurs when the form is committed, because the contact list
of the Person can’t be updated since this line

 if (null == value || type.isAssignableFrom(value.getClass())) 

in the MethodProperty class returns false;
the java.util.List is not assignable from HashSet.class.

All this works fine if the list of contacts the person contains were a Set.
But unfortunately it isn’t. This person bean comes from a persistence model
that is given.

can anyone recommend a way to deal with this?
I’d like to keep the convenience of the form updating all the bean
properties :slight_smile: