本文整理汇总了Java中org.apache.bcel.classfile.Utility.methodSignatureArgumentTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Utility.methodSignatureArgumentTypes方法的具体用法?Java Utility.methodSignatureArgumentTypes怎么用?Java Utility.methodSignatureArgumentTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.Utility
的用法示例。
在下文中一共展示了Utility.methodSignatureArgumentTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMethod
import org.apache.bcel.classfile.Utility; //导入方法依赖的package包/类
/**
* @see org.apache.bcel.classfile.Visitor#visitMethod(org.apache.bcel.classfile.Method)
*/
public void visitMethod(Method m) {
log(" method=" + m.getName(), Project.MSG_VERBOSE);
String retType = Utility.methodSignatureReturnType(m.getSignature());
log(" method ret type=" + retType, Project.MSG_VERBOSE);
if (!"void".equals(retType))
design.checkClass(retType);
String[] types = Utility.methodSignatureArgumentTypes(m.getSignature());
for (int i = 0; i < types.length; i++) {
log(" method param[" + i + "]=" + types[i], Project.MSG_VERBOSE);
design.checkClass(types[i]);
}
ExceptionTable excs = m.getExceptionTable();
if (excs != null) {
types = excs.getExceptionNames();
for (int i = 0; i < types.length; i++) {
log(" exc=" + types[i], Project.MSG_VERBOSE);
design.checkClass(types[i]);
}
}
processInstructions(m);
}
示例2: parseSignature
import org.apache.bcel.classfile.Utility; //导入方法依赖的package包/类
private Element parseSignature(String signature) {
org.jdom.Element sgn = new Element("signature", nsXMLVM);
String[] params = Utility.methodSignatureArgumentTypes(signature, false);
Element ret = new Element("return", nsXMLVM);
ret.setAttribute("type", Utility.methodSignatureReturnType(signature, false));
sgn.addContent(ret);
for (int i = 0; i < params.length; i++) {
Element param = new Element("parameter", nsXMLVM);
param.setAttribute("type", params[i]);
sgn.addContent(param);
}
return sgn;
}
示例3: writeMethod
import org.apache.bcel.classfile.Utility; //导入方法依赖的package包/类
private final void writeMethod( Method method, int method_number ) throws IOException {
// Get raw signature
String signature = method.getSignature();
// Get array of strings containing the argument types
String[] args = Utility.methodSignatureArgumentTypes(signature, false);
// Get return type string
String type = Utility.methodSignatureReturnType(signature, false);
// Get method name
String name = method.getName(), html_name;
// Get method's access flags
String access = Utility.accessToString(method.getAccessFlags());
// Get the method's attributes, the Code Attribute in particular
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);
byte tag = attributes[i].getTag();
if (tag == ATTR_EXCEPTIONS) {
file.print("<TR VALIGN=TOP><TD COLSPAN=2></TD><TH ALIGN=LEFT>throws</TH><TD>");
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 == ATTR_CODE) {
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);
}
}
}
}