We added the following to our Session:
public static final MySession get() {
return (MySession) Session.get();
}
And then we just call MySession.get() instead of calling getSession().
Scott
On Tue, Jan 6, 2009 at 9:59 AM, Dane Laverty <[email protected]> wrote:
> Is there an easy way to add/override a function to all my Wicket classes
> (panels, pages, forms, etc.)? For example, I have a custom session.
> Rather than having to cast (MySession)getSession() , I just want
> getSession() to return a MySession. Two solutions come to mind, but
> neither seems optimal.
>
>
>
> First, I could create a MyPanel for all my panels to extend, a MyPage
> for all my pages to extend, etc. and have MyPanel and MyPage override
> getSession(). However, that means a lot of duplicated code.
>
>
>
> Second, I could update the Wicket source code, which would be quick and
> easy, but then make upgrading Wicket difficult.
>
>
>
> Is there a simple Java solution that allows me to change/add function
> definitions into existing inheritance hierarchies?
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]