Beispiel #1
0
 /** Constructs the fully qualified name of this class, including package path. */
 public String getFullName() {
   StringBuffer buf = new StringBuffer();
   String packagename = getPackageName();
   if (packagename != null) {
     buf.append(packagename);
     buf.append('.');
   }
   int pos = buf.length();
   for (JavaClass i = this; i != null; i = i.getParent()) {
     if (i != this) buf.insert(pos, '$');
     buf.insert(pos, i.getName());
   }
   return buf.toString();
 }
Beispiel #2
0
 /**
  * Constructs the fully qualified name of this class, including package path. The same as {@link
  * #getFullName()}, but without dots and dollars, so that this string can be used as part of a
  * java identifier.
  */
 public String getFullNameEscaped() {
   StringBuffer buf = new StringBuffer();
   String packagename = getPackageName();
   if (packagename != null) {
     buf.append('_');
     for (int i = 0; i < packagename.length(); i++) {
       char c = packagename.charAt(i);
       if (c == '.') buf.append('_');
       else buf.append(c);
     }
   }
   int pos = buf.length();
   for (JavaClass i = this; i != null; i = i.getParent()) {
     buf.insert(pos, i.getName());
     buf.insert(pos, '_');
   }
   return buf.toString();
 }