jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: 1078-DataModelRegistrable

From: Frank Caputo <frank_at_frankcaputo.de>
Date: Mon, 9 Mar 2015 20:40:47 +0100

+1

Ciao Frank

> Am 09.03.2015 um 17:31 schrieb Bauke Scholtz <balusc_at_gmail.com>:
>
> +1
>
> Cheers, B
>
> On Sun, Mar 8, 2015 at 11:22 PM, arjan tijms <arjan.tijms_at_gmail.com <mailto:arjan.tijms_at_gmail.com>> wrote:
> Hi,
>
> As the third part of extending the data model wrappers for UIData and
> UIRepeat, it was suggested to make data model wrappers registrable by
> the user. Issue JAVASERVERFACES_SPEC_PUBLIC-1078 was created for this,
> but it was also mentioned as part of JAVASERVERFACES_SPEC_PUBLIC-1103.
>
> I took a quick look, and now with CDI available it seems almost
> trivial to implement this.
>
> JSF would provide a CDI qualifier annotation like:
>
> @Retention(RUNTIME)
> @Target(TYPE)
> @Inherited
> @Qualifier
> public @interface FacesDataModel {
> Class<?> forClass();
> }
>
> The user then provides something like the following:
>
> @FacesDataModel(forClass=MyObject.class)
> public class MyDataModel<E> extends DataModel<E> {
> // datamodel methods
> }
>
> The runtime then looks up an instance of that via CDI (just like
> happens now for CD Converters and Validators, which is almost a
> one-liner in Manfred's CDIUtils).
>
> Thoughts?
>
> Kind regards,
> Arjan Tijms
>