01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.transform;
05:
06: /**
07: * A tuple based on className and defining ClassLoader object
08: *
09: * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
10: */
11: public class ClassCacheTuple {
12: private ClassLoader classLoader;
13:
14: private String className;
15:
16: public ClassCacheTuple(ClassLoader classLoader, String className) {
17: setClassLoader(classLoader);
18: setClassName(className);
19: }
20:
21: public ClassCacheTuple(Class klass) {
22: setClassLoader(klass.getClassLoader());
23: setClassName(klass.getName());
24: }
25:
26: public ClassLoader getClassLoader() {
27: return classLoader;
28: }
29:
30: public void setClassLoader(ClassLoader classLoader) {
31: this .classLoader = classLoader;
32: }
33:
34: public String getClassName() {
35: return className;
36: }
37:
38: public void setClassName(String className) {
39: this .className = className;
40: }
41:
42: public boolean equals(Object 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: }
|