KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jdon > controller > cache > CacheKey


1 /**
2  * Copyright 2003-2006 the original author or authors.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6
7        http://www.apache.org/licenses/LICENSE-2.0
8
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */

15
16 package com.jdon.controller.cache;
17
18 /**
19  * Instances of the ObjectKey class identify the object
20  * that will be fetched from the cache.
21  *
22  * @author banq
23  * @version 1.0
24  */

25 public class CacheKey implements StringKey {
26   private String JavaDoc cacheType;
27   private Object JavaDoc dataKey;
28   private String JavaDoc dataTypeName;
29
30   public CacheKey(String JavaDoc cacheType, Object JavaDoc dataKey, String JavaDoc dataTypeName) {
31     this.cacheType = cacheType;
32     this.dataTypeName = dataTypeName;
33     this.dataKey = dataKey;
34   }
35
36   public String JavaDoc getCacheType() {
37     return cacheType;
38   }
39
40   public Object JavaDoc getDataKey() {
41     return dataKey;
42   }
43
44   public String JavaDoc getDataTypeName() {
45     return dataTypeName;
46   }
47
48   public void setCacheType(String JavaDoc cacheType) {
49     this.cacheType = cacheType;
50   }
51
52   public void setDataKey(Object JavaDoc dataKey) {
53     this.dataKey = dataKey;
54   }
55
56   public void setDataTypeName(String JavaDoc dataTypeName) {
57     this.dataTypeName = dataTypeName;
58   }
59
60   public String JavaDoc toString() {
61     StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(cacheType);
62     buffer.append(dataTypeName);
63     if (dataKey != null)
64       buffer.append(dataKey.toString());
65     return buffer.toString();
66   }
67
68 }
69
Popular Tags