KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jdon > model > ModelKey


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.model;
17
18 /**
19  * 用于实现Model缓存的Key
20  *
21  * <p>Copyright: Jdon.com Copyright (c) 2005</p>
22  * <p></p>
23  * @author banq
24  * @version JdonFramework 2005 v1.0
25  */

26 public class ModelKey {
27
28   private Object JavaDoc dataKey;
29   private String JavaDoc formName;
30   private Class JavaDoc modelClass;
31
32   public ModelKey(Object JavaDoc dataKey, String JavaDoc formName){
33     this.dataKey = dataKey;
34     this.formName = formName;
35   }
36
37   public ModelKey(Object JavaDoc dataKey, Class JavaDoc modelClass){
38     this.dataKey = dataKey;
39     this.modelClass = modelClass;
40   }
41
42
43   public Object JavaDoc getDataKey() {
44     return dataKey;
45   }
46   public String JavaDoc getFormName() {
47     return formName;
48   }
49   public Class JavaDoc getModelClassName() {
50     return modelClass;
51   }
52   public void setDataKey(Object JavaDoc dataKey) {
53     this.dataKey = dataKey;
54   }
55   public void setFormName(String JavaDoc formName) {
56     this.formName = formName;
57   }
58   public void setModelClassName(Class JavaDoc modelClass) {
59     this.modelClass = modelClass;
60   }
61
62   /**
63    * 最好ä¸?使用本方法,容易和真正的CacheKeyæ··æ·†
64    * @return String
65    */

66   public String JavaDoc toString(){
67     StringBuffer JavaDoc buf = new StringBuffer JavaDoc("ModelKey include: dataKey=");
68     buf.append(dataKey.toString());
69     if (modelClass != null)
70        buf.append(" modelClass =").append(modelClass);
71     else if (formName != null)
72       buf.append(" formName =").append(formName);
73     return buf.toString();
74   }
75
76 }
77
Popular Tags