1 5 package com.tc.object.dmi; 6 7 import com.tc.util.Assert; 8 9 public class DmiClassSpec { 10 11 private final String classLoaderDesc; 12 private final String className; 13 private final String spec; 14 15 public DmiClassSpec(final String classLoaderDesc, final String className) { 16 Assert.pre(classLoaderDesc != null); 17 Assert.pre(className != null); 18 this.classLoaderDesc = classLoaderDesc; 19 this.className = className; 20 this.spec = classLoaderDesc + "-" + className; 21 } 22 23 public String getClassLoaderDesc() { 24 return classLoaderDesc; 25 } 26 27 public String getClassName() { 28 return className; 29 } 30 31 public int hashCode() { 32 return spec.hashCode(); 33 } 34 35 public boolean equals(Object obj) { 36 if (!(obj instanceof DmiClassSpec)) return false; 37 DmiClassSpec that = (DmiClassSpec) obj; 38 return this.spec.equals(that.spec); 39 } 40 41 public String toString() { 42 return "DmiClassSpec{loader=" + classLoaderDesc + ", className=" + className + "}"; 43 } 44 45 public static String toString(DmiClassSpec[] specs) { 46 StringBuffer sb = new StringBuffer (); 47 sb.append("["); 48 for (int i = 0; i < specs.length; i++) { 49 sb.append(specs[i].toString()).append(","); 50 } 51 sb.append("]"); 52 return sb.toString(); 53 } 54 } 55 | Popular Tags |