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.object.dna.impl;
05:
06: import com.tc.object.loaders.ClassProvider;
07:
08: import java.io.Serializable;
09:
10: public class ClassLoaderInstance implements Serializable {
11:
12: private final UTF8ByteDataHolder loaderDef;
13:
14: public ClassLoaderInstance(UTF8ByteDataHolder loaderDefinition) {
15: loaderDef = loaderDefinition;
16: }
17:
18: public boolean equals(Object obj) {
19: if (obj instanceof ClassLoaderInstance) {
20: ClassLoaderInstance other = (ClassLoaderInstance) obj;
21: return this .loaderDef.equals(other.loaderDef);
22: }
23: return false;
24: }
25:
26: public ClassLoader asClassLoader(ClassProvider classProvider) {
27: String classLoaderdef = loaderDef.asString();
28: return classProvider.getClassLoader(classLoaderdef);
29: }
30:
31: public int hashCode() {
32: int hash = 17;
33: hash = (37 * hash) + loaderDef.hashCode();
34: return hash;
35: }
36:
37: public UTF8ByteDataHolder getLoaderDef() {
38: return loaderDef;
39: }
40: }
|