Hello!

I got a problem with type mysmatch then implementing custom component.

First of all, the code^
public class EnumCheckGroup<T extends Enum> extends
FormComponentPanel<Collection<T>> {
....
 public EnumCheckGroup(final String id, final IModel<? extends
Collection<T>> model, final Class<T> enumClass) {
        //noinspection unchecked
        super(id, (IModel<Collection<T>>) model);

        group = new CheckGroup<T>("checkgroup", model);
...
}

That model comes from:
CompoundPropertyModel<Group> formModel = new
CompoundPropertyModel<Group>(service.createGroup());
..
 EnumCheckGroup checkGroup = new EnumCheckGroup("roles",
formModel.bind("roles"), RoleEnum.class);

Roles is a set of Enum and has getter and setter like  Set getRoles /
Group setRoles(Set)

all of that renders already filled Set without problems, but fails to
set with type mismatch. PropertyResolver#setValue receives value as
ArrayList while property is a Set.
If I call setType(getModelObject.getClass) on CheckGroup it tryes to
convert every Check to PersistentSet (hibernate proxy for a Set) so it
doesnt look like a solution.

Call of setType(getModelObject.getClass) in beforeRender() changes nothing.

Any ideas? Thanks in advance...
-- 
Best regards
Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to