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

[jsr372-experts] Re: [jsr372-experts mirror] Re: 1078-DataModelRegistrable

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Wed, 3 Jun 2015 01:04:43 +0200

Hi y'all,

Just some quick update on this. After a small hiatus I returned to this
issue and started implementing it. There were a few small challenges that
made this issue a bit more difficult than initially anticipated.

Specifically the fact that registering a DataModel for say java.util.List
requires some clever matching of class types, as the runtime object
encountered can be e.g. an ArrayList or whatever sub type, and the
"whatever sub type" can have a chain of super classes and a tree of
interfaces and their super interfaces, where each super class can also have
its own tree of interfaces and their super interfaces.

A small hindrance is also that UIData (of course) contains implementation
code, but it's in the API project of Mojarra which can't/doesn't have
utility classes. So UIData and UIRepeat can't share between each other
directly, nor can either of them use a utility class from the impl. project.

Nevertheless I'm making good progress and hope to present a changebundle
for evaluation soon.

Kind regards,
Arjan Tijms




On Tue, Mar 10, 2015 at 9:17 AM, Hanspeter <hampidu_at_gmail.com> wrote:

> +1
>
> Hanspeter
> Am 09.03.2015 20:41 schrieb "Frank Caputo" <frank_at_frankcaputo.de>:
>
>> +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>
>> 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
>>>
>>
>>
>>