Hi
> ad 1) no - not even protected is allowed. The problem is that you
> don't want an application to rely on a certain implementation of the
> api - you change the api, and nothing works anymore ;)
>   
Ok, thats bad.
> ad 2) yes, well, instanceof to UIData is bad. There I'm completely
> d'accord with Simon. But an instanceof to an interface defining some
> generic behaviour is pretty ok in my opinion. not marker interface
> instead of instanceof, but instanceof to marker interface instead of
> to UIData.
>   
Ok, I understand.

There is still one last idea, a little bit complicated, but this avoids
this marker interface too.
You could have a TraversePolicyProvider.

Lets speak code:

TraversePolicyFactroy.register(UIComponent.class, new
TraverseComponentChildren());
TraversePolicyFactroy.register(UIData.class, new TraverseDataChildren());

Then on TraversePolicyFactroy:
TraversePolicy create(UIComponent component)
{
    find a TraversePolicy for component.getClass() or one of its super
classes.
    return it;
}

Somewhat complicated, but hey it works. Is extensible and didnt need any
change on the api and no marker interface.


Ciao,
Mario

Reply via email to