1 19 20 package org.netbeans.modules.javacore.parser; 21 22 import java.io.IOException ; 23 import java.io.InputStream ; 24 import java.io.OutputStream ; 25 import org.netbeans.jmi.javamodel.JavaClass; 26 import org.netbeans.mdr.storagemodel.StorableBaseObject; 27 import org.openide.util.Utilities; 28 29 public class LocalClassNameRef extends NameRef { 30 private int hashCode; 31 public String mofId; 32 33 public static Object read(InputStream stream, StorableBaseObject storable) throws IOException { 34 throw new UnsupportedOperationException (); 35 } 36 37 public void write(OutputStream outputStream, StorableBaseObject storable) throws IOException { 38 throw new UnsupportedOperationException (); 39 } 40 41 public LocalClassNameRef(JavaClass jcls) { 42 this(jcls,null,null); 43 } 44 45 public LocalClassNameRef(JavaClass jcls,TypeParamRef par,TypeRef[] args) { 46 super(jcls.getName(),par,args); 47 mofId=jcls.refMofId(); 48 } 49 50 public boolean equals(Object typeRef) { 51 LocalClassNameRef ref; 52 53 if (this==typeRef) 54 return true; 55 if (!(typeRef instanceof LocalClassNameRef)) 56 return false; 57 ref=(LocalClassNameRef)typeRef; 58 if (!mofId.equals(ref.mofId)) 59 return false; 60 if (!Utilities.compareObjects(parent,ref.parent)) 61 return false; 62 return Utilities.compareObjects(args,ref.args); 63 } 64 65 String getName() { 66 String parentString=""; 67 68 if (parent!=null) { 69 parentString=parent.getName().concat("."); } 71 return parentString.concat(name); 72 } 73 74 public int hashCode() { 75 if (hashCode!=0) { 76 hashCode=mofId.hashCode(); 77 78 if (parent!=null) 79 hashCode^=parent.hashCode(); 80 hashCode^=args.hashCode(); 81 } 82 return hashCode; 83 } 84 } 85 | Popular Tags |