Java Code Examples for com.sun.org.apache.bcel.internal.classfile.Utility#methodSignatureArgumentTypes()
The following examples show how to use
com.sun.org.apache.bcel.internal.classfile.Utility#methodSignatureArgumentTypes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodHTML.java From Bytecoder with Apache License 2.0 | 4 votes |
private void writeMethod( final Method method, final int method_number ) { // Get raw signature final String signature = method.getSignature(); // Get array of strings containing the argument types final String[] args = Utility.methodSignatureArgumentTypes(signature, false); // Get return type string final String type = Utility.methodSignatureReturnType(signature, false); // Get method name final String name = method.getName(); String html_name; // Get method's access flags String access = Utility.accessToString(method.getAccessFlags()); // Get the method's attributes, the Code Attribute in particular final Attribute[] attributes = method.getAttributes(); /* HTML doesn't like names like <clinit> and spaces are places to break * lines. Both we don't want... */ access = Utility.replace(access, " ", " "); html_name = Class2HTML.toHTML(name); file.print("<TR VALIGN=TOP><TD><FONT COLOR=\"#FF0000\"><A NAME=method" + method_number + ">" + access + "</A></FONT></TD>"); file.print("<TD>" + Class2HTML.referenceType(type) + "</TD><TD>" + "<A HREF=" + class_name + "_code.html#method" + method_number + " TARGET=Code>" + html_name + "</A></TD>\n<TD>("); for (int i = 0; i < args.length; i++) { file.print(Class2HTML.referenceType(args[i])); if (i < args.length - 1) { file.print(", "); } } file.print(")</TD></TR>"); // Check for thrown exceptions for (int i = 0; i < attributes.length; i++) { attribute_html.writeAttribute(attributes[i], "method" + method_number + "@" + i, method_number); final byte tag = attributes[i].getTag(); if (tag == Const.ATTR_EXCEPTIONS) { file.print("<TR VALIGN=TOP><TD COLSPAN=2></TD><TH ALIGN=LEFT>throws</TH><TD>"); final int[] exceptions = ((ExceptionTable) attributes[i]).getExceptionIndexTable(); for (int j = 0; j < exceptions.length; j++) { file.print(constant_html.referenceConstant(exceptions[j])); if (j < exceptions.length - 1) { file.print(", "); } } file.println("</TD></TR>"); } else if (tag == Const.ATTR_CODE) { final Attribute[] c_a = ((Code) attributes[i]).getAttributes(); for (int j = 0; j < c_a.length; j++) { attribute_html.writeAttribute(c_a[j], "method" + method_number + "@" + i + "@" + j, method_number); } } } }