KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > dna > impl > ClassLoaderInstance


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.object.dna.impl;
5
6 import com.tc.object.loaders.ClassProvider;
7
8 import java.io.Serializable JavaDoc;
9
10 public class ClassLoaderInstance implements Serializable JavaDoc {
11
12   private final UTF8ByteDataHolder loaderDef;
13
14   public ClassLoaderInstance(UTF8ByteDataHolder loaderDefinition) {
15     loaderDef = loaderDefinition;
16   }
17
18   public boolean equals(Object JavaDoc 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 JavaDoc asClassLoader(ClassProvider classProvider) {
27     String JavaDoc 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 }
41
Popular Tags