View Javadoc

1   /*
2   MadCaching is a Tile Caching solution
3   Copyright (C) 2005  Mac Vu
4   
5   This program is free software; you can redistribute it and/or
6   modify it under the terms of the GNU General Public License
7   as published by the Free Software Foundation; either version 2
8   of the License, or (at your option) any later version.
9   
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  GNU General Public License for more details.
14  
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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  }