01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package org.codehaus.aspectwerkz.transform;
08:
09: /**
10: * A tuple based on className and defining ClassLoader object
11: *
12: * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
13: */
14: public class ClassCacheTuple {
15: private ClassLoader classLoader;
16:
17: private String className;
18:
19: public ClassCacheTuple(ClassLoader classLoader, String className) {
20: setClassLoader(classLoader);
21: setClassName(className);
22: }
23:
24: public ClassCacheTuple(Class klass) {
25: setClassLoader(klass.getClassLoader());
26: setClassName(klass.getName());
27: }
28:
29: public ClassLoader getClassLoader() {
30: return classLoader;
31: }
32:
33: public void setClassLoader(ClassLoader classLoader) {
34: this .classLoader = classLoader;
35: }
36:
37: public String getClassName() {
38: return className;
39: }
40:
41: public void setClassName(String className) {
42: this .className = className;
43: }
44:
45: public boolean equals(Object o) {
46: if (this == o) {
47: return true;
48: }
49: if (!(o instanceof ClassCacheTuple)) {
50: return false;
51: }
52: final ClassCacheTuple classCacheTuple = (ClassCacheTuple) o;
53: if (!classLoader.equals(classCacheTuple.classLoader)) {
54: return false;
55: }
56: if (!className.equals(classCacheTuple.className)) {
57: return false;
58: }
59: return true;
60: }
61:
62: public int hashCode() {
63: int result;
64: result = classLoader.hashCode();
65: result = (29 * result) + className.hashCode();
66: return result;
67: }
68: }
|