/** * Returns a binary name of the {@link TypeElement} represented by this * {@link ElementHandle}. When the {@link ElementHandle} doesn't represent * a {@link TypeElement} it throws a {@link IllegalStateException} * @return the qualified name * @throws an {@link IllegalStateException} when this {@link ElementHandle} * isn't created for the {@link TypeElement}. */ public @NonNull String getBinaryName () throws IllegalStateException { if ((this.kind.isClass() && !isArray(signatures[0])) || this.kind.isInterface() || this.kind == ElementKind.OTHER) { return this.signatures[0]; } else { throw new IllegalStateException (); } }
/** * Returns a qualified name of the {@link TypeElement} represented by this * {@link ElementHandle}. When the {@link ElementHandle} doesn't represent * a {@link TypeElement} it throws a {@link IllegalStateException} * @return the qualified name * @throws an {@link IllegalStateException} when this {@link ElementHandle} * isn't creatred for the {@link TypeElement}. */ public @NonNull String getQualifiedName () throws IllegalStateException { if ((this.kind.isClass() && !isArray(signatures[0])) || this.kind.isInterface() || this.kind == ElementKind.OTHER) { return this.signatures[0].replace (Target.DEFAULT.syntheticNameChar(),'.'); //NOI18N } else { throw new IllegalStateException (); } }
private static Element getTypeElementByBinaryName (final String signature, final JavacTaskImpl jt) { if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Calling getTypeElementByBinaryName: signature = {0}", signature); if (isNone(signature)) { return Symtab.instance(jt.getContext()).noSymbol; } else if (isArray(signature)) { return Symtab.instance(jt.getContext()).arrayClass; } else { final JavacElements elements = (JavacElements) jt.getElements(); return (TypeElement) elements.getTypeElementByBinaryName(signature); } }