01: /*
02: * $Id: AbstractPageMapEntry.java 458720 2006-01-17 13:53:59Z jcompagner $
03: * $Revision: 458720 $ $Date: 2006-01-17 14:53:59 +0100 (Tue, 17 Jan 2006) $
04: *
05: * ==============================================================================
06: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
07: * use this file except in compliance with the License. You may obtain a copy of
08: * the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15: * License for the specific language governing permissions and limitations under
16: * the License.
17: */
18: package wicket.session.pagemap;
19:
20: import wicket.Page;
21:
22: /**
23: * An abstract base class that makes it easier to create IPageMapEntry
24: * implementations.
25: *
26: * @author Jonathan Locke
27: */
28: public abstract class AbstractPageMapEntry implements IPageMapEntry {
29: private short id;
30:
31: /**
32: * @see wicket.session.pagemap.IPageMapEntry#getNumericId()
33: */
34: public int getNumericId() {
35: return id;
36: }
37:
38: /**
39: * @see wicket.session.pagemap.IPageMapEntry#getPage()
40: */
41: public abstract Page getPage();
42:
43: /**
44: * Failing to override this method could be pretty expensive because this
45: * default implementation calls getPage(), which probably creates the page.
46: * That's a lot of work to do in order to simply determine the page's class.
47: * So, if there's an easy way to implement this method, that might be
48: * desirable.
49: *
50: * @see wicket.session.pagemap.IPageMapEntry#getPageClass()
51: */
52: public Class getPageClass() {
53: return getPage().getClass();
54: }
55:
56: /**
57: * @see wicket.session.pagemap.IPageMapEntry#setNumericId(int)
58: */
59: public void setNumericId(int id) {
60: this .id = (short) id;
61: }
62: }
|