users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] [jsr344-experts] Re: Re: [1072, 1079, 1109, 1110] Wrappers

From: Leonardo Uribe <lu4242_at_gmail.com>
Date: Mon, 17 Dec 2012 13:30:11 -0500

Hi

> NG> @ListenerFor(systemEventClass = PreRenderComponentEvent.class)
> NG> @ResourceDependency(library = "javax.faces", name = "jsf.js", target = "head")
> NG> public class MyRenderer extends RendererWrapper implements ComponentSystemEventListener {

If I have a Renderer x that I want to wrap with y, will the annotations
under x be inherited?

In MyFaces Extval case, it is necessary a wrapper that can be
generated for all renderers in a renderkit that has that ability, but
note in this case, the implementation should wrap the Renderer
without know the renderer class itself.

For example, if a renderer implements ComponentSystemEventListener,
I want a wrapper that has the ability of wrap both interfaces.

Since you don't really know that beforehand, I think it has sense
to provide a "factory" method in RenderKit class. It has sense,
because you could have multiple alternate "contracts" bound to
a Renderer class but per renderkit.

There are two cases:

1. Provide a wrapper for a specific known Renderer class.
2. Provide a wrapper according to an unknown Renderer class, but
with known implemented contracts, no matter how those contracts
are used to.

Maybe something like:

public Renderer createRendererWrapper(Renderer toWrap)

Does that sounds good? The typical use case is when you need to
wrap a complete RenderKit. Note for Renderer wrapper, it is useful
to know which wrappers are present, so RendererWrapper should
provide a way to scan them.

regards,

Leonardo Uribe