KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > transform > ClassCacheTuple


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.aspectwerkz.transform;
5
6 /**
7  * A tuple based on className and defining ClassLoader object
8  *
9  * @author <a HREF="mailto:alex@gnilux.com">Alexandre Vasseur </a>
10  */

11 public class ClassCacheTuple {
12   private ClassLoader JavaDoc classLoader;
13
14   private String JavaDoc className;
15
16   public ClassCacheTuple(ClassLoader JavaDoc classLoader, String JavaDoc className) {
17     setClassLoader(classLoader);
18     setClassName(className);
19   }
20
21   public ClassCacheTuple(Class JavaDoc klass) {
22     setClassLoader(klass.getClassLoader());
23     setClassName(klass.getName());
24   }
25
26   public ClassLoader JavaDoc getClassLoader() {
27     return classLoader;
28   }
29
30   public void setClassLoader(ClassLoader JavaDoc classLoader) {
31     this.classLoader = classLoader;
32   }
33
34   public String JavaDoc getClassName() {
35     return className;
36   }
37
38   public void setClassName(String JavaDoc className) {
39     this.className = className;
40   }
41
42   public boolean equals(Object JavaDoc o) {
43     if (this == o) {
44       return true;
45     }
46     if (!(o instanceof ClassCacheTuple)) {
47       return false;
48     }
49     final ClassCacheTuple classCacheTuple = (ClassCacheTuple) o;
50     if (!classLoader.equals(classCacheTuple.classLoader)) {
51       return false;
52     }
53     if (!className.equals(classCacheTuple.className)) {
54       return false;
55     }
56     return true;
57   }
58
59   public int hashCode() {
60     int result;
61     result = classLoader.hashCode();
62     result = (29 * result) + className.hashCode();
63     return result;
64   }
65 }
Popular Tags