Any objections against this change:

    protected final IModel getInnermostModel(final IModel model)
    {
        IModel nested = model;
        while (nested != null && nested instanceof IWrapModel)
        {
            final IModel next = ((IWrapModel)nested).getWrappedModel();
            if (nested == next)
            {
                throw new WicketRuntimeException("Model for " + nested + "
is self-referential");
            }
            nested = next;
        }
        return nested;
    }

to

    protected final IModel getInnermostModel(final IModel model)
    {
        IModel nested = model;
        while (nested != null && nested instanceof IWrapModel)
        {
            final IModel next = ((IWrapModel)nested).getWrappedModel();
            if (nested == next)
            {
                // found it is a IAssignableModel that wraps itself.
                return nested;
            }
            nested = next;
        }
        return nested;
    }

because i have a lot of places where i know the model instance will be used
only once,
so in a 1 -> 1 relationship with the component. But it needs the component.
Then it is much easier to have a base Model that is both assignable and
iwrapmodel and that
stores the component in itself. Ofcourse i can fix by introducing another
layer and generation
a few more methods. But are we really wanting the above nested check?

johan

Reply via email to