Exemplo n.º 1
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");
  }
Exemplo n.º 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) {
        c = constants[nameIndex.intValue()];
        if (c.tag() == Constant.UTF8) {
          String s = (String) c.value();
          return s.replace('/', '.');
        }
      }
    }

    return null;
  }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
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;
  }