This content has been marked as final.
Show 2 replies
-
1. Re: @In with primitives
shane.bryzak Mar 7, 2007 8:19 AM (in response to docjava)Best practice I'd say is to use an Integer.
-
2. Re: @In with primitives
docjava Mar 7, 2007 9:42 AM (in response to docjava)"shane.bryzak@jboss.com" wrote:
Best practice I'd say is to use an Integer.
Hi Shane, thanks for your time.
While it obviously is a good idea to switch to Integer where null-references are wanted, the fact that i used an int initially is a good indicator, that null isn´t that useful ;)
I do not see, what is wrong with using primitives here. The problem was that the initialization must be done via Seam like this:
@In(create=true)
@Out(scope = ScopeType.SESSION)
private int documentListPageSize;
@Factory(value = "documentListPageSize", scope = ScopeType.SESSION)
public int createDocumentListPageSize()
{
return UIListHelper.DEFAULT_PAGE_SIZE;
}
The problem was that create=true was missing on @In.
While this works fine now (yep, with *int*s), it looks like doing this programmatically is quite more readable, than the above use of Annotations:
private SeamSessionLocal pageSize = new SeamSessionLocal("documentListPageSize",
UIListHelper.DEFAULT_PAGE_SIZE);
where SeamSessionLocal is a wrapper to an Attribute of the SessionContext.
Well kind of flavour, i guess.
Thanks again Shane.