[jboss-user] [JBoss Seam] - Re: @In with primitives
docjava
do-not-reply at jboss.com
Wed Mar 7 09:42:36 EST 2007
"shane.bryzak at 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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025806#4025806
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025806
More information about the jboss-user
mailing list