Beispiel #1
0
 public String className(int idx) {
   Constant c;
   c = constants[idx];
   if (c.tag() == Constant.UTF8) {
     String s = (String) c.value();
     return s.replace('/', '.');
   }
   return null;
 }
Beispiel #2
0
  /** Get the class name at the given constant pool index. */
  public String classNameCP(int index) {
    Constant c = constants[index];

    if (c != null && c.tag() == Constant.CLASS) {
      Integer nameIndex = (Integer) c.value();
      if (nameIndex != null) {
        return className(nameIndex.intValue());
      }
    }

    return null;
  }
Beispiel #3
0
  /**
   * Get the name of the class, including the package name.
   *
   * @return The name of the class.
   */
  public String name() {
    Constant c = constants[thisClass];
    if (c.tag() == Constant.CLASS) {
      Integer nameIndex = (Integer) c.value();
      if (nameIndex != null) {
        c = constants[nameIndex.intValue()];
        if (c.tag() == Constant.UTF8) {
          return (String) c.value();
        }
      }
    }

    throw new ClassFormatError("Couldn't find class name in file");
  }
  /** Get the class name at the given constant pool index. */
  public String classNameCP(int index) {
    Constant c = constants[index];

    if (c != null && c.tag() == Constant.CLASS) {
      Integer nameIndex = (Integer) c.value();
      if (nameIndex != null) {
        c = constants[nameIndex.intValue()];
        if (c.tag() == Constant.UTF8) {
          String s = (String) c.value();
          return s.replace('/', '.');
        }
      }
    }

    return null;
  }