Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PageKey |
|
| 3.6;3.6 |
1 | package org.apache.tapestry.internal.pageload; | |
2 | ||
3 | import java.io.Serializable; | |
4 | import java.util.Locale; | |
5 | ||
6 | /** | |
7 | * Alterantive implementation of {@link org.apache.tapestry.util.MultiKey} that is specifically | |
8 | * intended to be used to store and retrieve pages from a pool. | |
9 | * | |
10 | */ | |
11 | public class PageKey implements Serializable { | |
12 | ||
13 | String _pageName; | |
14 | Locale _locale; | |
15 | ||
16 | /** | |
17 | * Constructs a new instance for the specified page / locale. | |
18 | * @param pageName | |
19 | * The page. | |
20 | * @param locale | |
21 | * Locale of the page. | |
22 | */ | |
23 | public PageKey(String pageName, Locale locale) | |
24 | 0 | { |
25 | 0 | _pageName = pageName; |
26 | 0 | _locale = locale; |
27 | 0 | } |
28 | ||
29 | public String getPageName() | |
30 | { | |
31 | 0 | return _pageName; |
32 | } | |
33 | ||
34 | public String toString() | |
35 | { | |
36 | 0 | return "PageKey[" + |
37 | "_pageName='" + _pageName + '\'' + | |
38 | '\n' + | |
39 | ", _locale=" + _locale + | |
40 | '\n' + | |
41 | ']'; | |
42 | } | |
43 | ||
44 | public boolean equals(Object o) | |
45 | { | |
46 | 0 | if (this == o) return true; |
47 | 0 | if (o == null || getClass() != o.getClass()) return false; |
48 | ||
49 | 0 | PageKey pageKey = (PageKey) o; |
50 | ||
51 | 0 | if (_locale != null ? !_locale.equals(pageKey._locale) : pageKey._locale != null) return false; |
52 | 0 | if (_pageName != null ? !_pageName.equals(pageKey._pageName) : pageKey._pageName != null) return false; |
53 | ||
54 | 0 | return true; |
55 | } | |
56 | ||
57 | public int hashCode() | |
58 | { | |
59 | int result; | |
60 | 0 | result = (_pageName != null ? _pageName.hashCode() : 0); |
61 | 0 | result = 31 * result + (_locale != null ? _locale.hashCode() : 0); |
62 | 0 | return result; |
63 | } | |
64 | } |