Exemple #1
0
  public String toString() {
    Name name = name();

    if (kind() == null) {
      return "<unknown class " + name + typeParameterString() + ">";
    }

    if (kind() == ANONYMOUS) {
      if (interfaces != null && !interfaces.isEmpty()) {
        return isFunction()
            ? "" + interfaces.get(0)
            : "<anonymous subtype of " + interfaces.get(0) + typeParameters() + ">";
      }
      if (superType != null) {
        return "<anonymous subclass of " + superType + ">" + typeParameterString();
      }
    }

    if (kind() == TOP_LEVEL) {
      Package p = Types.get(package_());
      return (p != null ? p.toString() + "." : "") + name + typeParameterString();
    } else if (kind() == MEMBER) {
      ClassDef outer = Types.get(outer());
      return (outer != null ? outer.toString() + "." : "") + name + typeParameterString();
    } else {
      return name.toString() + typeParameterString();
    }
  }
Exemple #2
0
  /** Get the full name of the class, if possible. */
  public QName fullName() {
    Name name = name();

    if (kind() == TOP_LEVEL) {
      Package p = Types.get(package_());
      return QName.make(p != null ? p.fullName() : null, name);
    } else if (kind() == MEMBER) {
      ClassDef outer = Types.get(outer());
      return QName.make(outer != null ? outer.fullName() : null, name);
    } else if (kind() == LOCAL) {
      return QName.make(null, name);
    } else if (kind() == ANONYMOUS) {
      return QName.make(null, Name.make("<anonymous class>"));
    } else {
      return QName.make(null, Name.make("<unknown class>"));
    }
  }
 public String toString() {
   return name.toString(); //  + "@" + index;
 }