Seam has a relatively small number of (mostly static) xml config files (thank God). I'm not sure it's even necessary to convert the pages.xml to a class or even if all users would want that. Yes, type safety is good, but it's easier to read in xml format sometimes. If you leave the option of class or xml then it's ok.
Is the Page class/enum going to be something that is extended or polymorphic, etc? Why convert to OO if the only reason is type-safety assurance in this case (plz don't beat this comment down, yes, maybe I'm missing something).
It would be pretty cool if there was a new utility that converted a pages.xml to class/OO format...
find . | grep xhtml | wc
392 392 21192
It's going to be a big enum... we would need to make sure that you could split it up.
The only real problem I have with this approach is that all the metadata that is availible is hard coded into the page class, which means the page class has to know about every module that wants to use page level metadata. Also, you can't really configure it via xml, which I am not too worried about but may alienate some users.
Stuart
On 19/02/2010, at 4:40 PM, Gavin King wrote:
> You should even be able to make this work:
>
> @View(.....)
> login {
> @Inject Login loginBean;
> public MyAppPage next(MyAppPage page, Object outcome) {
> if ( loginBean.isLoggedIn() )
> return main;
> else
> return login;
> }
> },
>
> of course we would need a little infrastructure for injecting into enum values.
>
> On Thu, Feb 18, 2010 at 11:37 PM, Gavin King <gavin.king@gmail.com> wrote:
>> Oops, this is a MUCH better way to write this code:
>>
>>
>> public enum MyAppPage implements Page<MyAppPage> {
>>
>> @View(.....)
>> login {
>> public MyAppPage next(MyAppPage page, Object outcome) {
>> if (Boolean.TRUE.equals(outcome))
>> return main;
>> else
>> return login;
>> }
>> },
>>
>> @View(.....)
>> main {
>> public MyAppPage next(MyAppPage page, Object outcome) {
>> return main;
>> }
>> },
>>
>> @View(.....)
>> logout {
>> public MyAppPage next(MyAppPage page, Object outcome) {
>> return login;
>> }
>> };
>>
>> }
>>
>
>
>
> --
> Gavin King
> gavin.king@gmail.com
> http://in.relation.to/Bloggers/Gavin
> http://hibernate.org
> http://seamframework.org
_______________________________________________
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev