home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 March / maximum-cd-1999-03.iso / Feature / Lotus / ORGANIZE / COMPNENT / LTOUIN21.ZIP / sunw / demo / classfile / ClassConstant.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-12-12  |  2.0 KB  |  47 lines

  1. package sunw.demo.classfile;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5.  
  6. class ClassConstant extends ConstantPoolEntry {
  7.    private UTF8Constant name;
  8.  
  9.    ClassConstant(String var1, ClassFile var2) {
  10.       super((byte)7, var2);
  11.       this.name = var2.addUTF8Constant(ClassFile.fullyQualifiedForm(var1));
  12.       ((ConstantPoolEntry)this).addToConstantPool();
  13.    }
  14.  
  15.    void write(DataOutputStream var1) throws IOException {
  16.       if (ConstantPoolEntry.debug()) {
  17.          System.err.println(((ConstantPoolEntry)this).getConstantPoolIndex() + " CLASS: " + this.name.getConstantPoolIndex());
  18.       }
  19.  
  20.       var1.writeByte(((ConstantPoolEntry)this).getTag());
  21.       var1.writeShort(this.name.getConstantPoolIndex());
  22.    }
  23.  
  24.    String getClassName() {
  25.       return this.name.getString();
  26.    }
  27.  
  28.    Class getClassObject() throws ClassNotFoundException {
  29.       return Class.forName(this.name.getString());
  30.    }
  31.  
  32.    public boolean equals(Object var1) {
  33.       if (var1 == null) {
  34.          return false;
  35.       } else if (var1 instanceof ClassConstant) {
  36.          ClassConstant var2 = (ClassConstant)var1;
  37.          return this.name.equals(var2.name);
  38.       } else {
  39.          return false;
  40.       }
  41.    }
  42.  
  43.    public int hashCode() {
  44.       return this.name.getString().hashCode();
  45.    }
  46. }
  47.