1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.macvu.tiles;
20
21 import com.macvu.tiles.xmlDefinition.XmlCacheAttribute;
22
23 public class CacheAttribute {
24
25 public static final String PARAM_SCOPE = "param";
26 public static final String PAGE_SCOPE = "page";
27 public static final String REQUEST_SCOPE = "request";
28 public static final String SESSION_SCOPE = "session";
29 public static final String APPLICATION_SCOPE = "application";
30
31 public static final String[] scope_order = {
32 PARAM_SCOPE,
33 PAGE_SCOPE,
34 REQUEST_SCOPE,
35 SESSION_SCOPE,
36 APPLICATION_SCOPE
37 };
38
39 String scope;
40 String name;
41
42 public CacheAttribute() {
43 }
44
45 public CacheAttribute(CacheAttribute attr) {
46 scope = attr.getScope();
47 name = attr.getName();
48 }
49
50 public CacheAttribute(XmlCacheAttribute attr) {
51 scope = attr.getScope();
52 name = attr.getName();
53 }
54
55 public CacheAttribute(String name, String scope) {
56 this.name = name;
57 this.scope = scope;
58 }
59
60 public String getName() {
61 return name;
62 }
63
64 public void setName(String name) {
65 this.name = name;
66 }
67
68 public String getScope() {
69 return scope;
70 }
71
72 public void setScope(String scope) {
73 this.scope = scope;
74 }
75
76 public boolean equals(Object obj) {
77 if (obj == null) {
78 return false;
79 }
80
81 CacheAttribute other = (CacheAttribute) obj;
82 if (other.getName().equals(name) && other.getScope().equals(scope)) {
83 return true;
84 }
85
86 return false;
87 }
88
89 public String toString() {
90 return "{name=" + name +
91 ", scope=" + scope + "}";
92 }
93 }