/** * Returns the signature of this method, as determined from its method descriptor. * * @return The signature of this method. */ public String getSignature() { StringBuffer sb = new StringBuffer(); // Return type. if (!isConstructor()) { // Don't print "void" return type. sb.append(getReturnTypeString(false)); sb.append(' '); } // Method name and param list. sb.append(getName()); sb.append('('); appendParamDescriptors(sb); sb.append(')'); // "throws" clause. for (int i = 0; i < getAttributeCount(); i++) { AttributeInfo ai = (AttributeInfo) attributes.get(i); if (ai instanceof Exceptions) { // At most 1 Exceptions attribute sb.append(" throws "); Exceptions ex = (Exceptions) ai; for (int j = 0; j < ex.getExceptionCount(); j++) { sb.append(ex.getException(j)); if (j < ex.getExceptionCount() - 1) { sb.append(", "); } } } } return sb.toString(); }
/** * Returns the specified attribute. * * @param index The index of the attribute. * @return The attribute. */ public AttributeInfo getAttribute(int index) { return (AttributeInfo) attributes.get(index); }