Hi,

>since Wicket serializes all the components anyways, what would it hurt to make a
>component final or a class member when declaring it?

your reasoning is sound, it does not hurt (besides 4 additional bytes for the object reference).

if I need to access them from an anonymous class I use the page.get("compId") 
method.
This has made my code very cumbersome and hard to read.

I've seen this in some projects, personally I can't stand this usage.
Regards
Sven


On 11/08/2013 05:08 PM, mashleyttu wrote:
Dumb question everyone,

I heard somewhere that it is bad to declare variables as final in Wicket
because they are treated as class members, and Wicket serializes the page
that would increase your session size.

Because of this I have not declared any components I add to my page as final
(or created class member variables for them), and if I need to access them
from an anonymous class I use the page.get("compId") method. This has made
my code very cumbersome and hard to read.

I got to thinking, since Wicket serializes all the components anyways, what
would it hurt to make a component final or a class member when declaring it?

It would sure make it easier to access later on. I really feel like an idiot
asking this question, just concerned about session size.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Components-as-Class-Members-tp4662235.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to