本文整理汇总了Java中org.apache.bcel.classfile.ExceptionTable.toString方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionTable.toString方法的具体用法?Java ExceptionTable.toString怎么用?Java ExceptionTable.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.bcel.classfile.ExceptionTable
的用法示例。
在下文中一共展示了ExceptionTable.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
/**
* Returns a string that represents a method part of
* a JNI-style header file.
*/
public String toString() {
String n = System.getProperty("line.separator");
StringBuffer result = new StringBuffer();
String methodName = Mangler.mangleUnicode(
clazz.getName() + "." + getName() + getSignature());
// Print a method comment.
result.append("/*" + n);
result.append(" * Method: " + methodName + n);
// Print the thrown exceptions.
ExceptionTable etable = wrappedMethod.getExceptionTable();
if (etable != null) {
String e = etable.toString();
if (e.length() > 0) {
result.append(" * Throws: ");
result.append(e);
result.append(n);
}
}
result.append(" */" + n);
// Print a method declaration in a readable way.
result.append("JNIEXPORT " + getJNIReturnType() + " JNICALL" + n);
result.append("Java_" + clazz.getMangledName() + "_" + getMangledName());
result.append('(');
result.append("JNIEnv *");
if (isStatic()) {
result.append(", jclass");
} else {
result.append(", jobject");
}
Type types[] = getArgumentTypes();
for (int i = 0; i < types.length; i++) {
result.append(", ");
if (i == 0) {
result.append(n);
result.append(" ");
}
result.append(ClazzMethod.getJNIType(types[i]));
}
result.append(");" + n);
result.append(n);
return result.toString();
}
示例2: toAlternativeString
import org.apache.bcel.classfile.ExceptionTable; //导入方法依赖的package包/类
/**
* Returns an alternative string that represents a method part of
* a JNI-style header file.
*/
public String toAlternativeString() {
String n = System.getProperty("line.separator");
StringBuffer result = new StringBuffer();
// Print a method comment.
result.append("/*" + n);
result.append(" * Class: " + Mangler.mangleUnicode(clazz.getName())
+ n);
result.append(" * Method: " + Mangler.mangleUnicode(getName()) + n);
result.append(" * Signature: " + getSignature() + n);
// Print the thrown exceptions.
ExceptionTable etable = wrappedMethod.getExceptionTable();
if (etable != null) {
String e = etable.toString();
if (e.length() > 0) {
result.append(" * Throws: ");
result.append(e);
result.append(n);
}
}
result.append(" */" + n);
// Print a method declaration in a readable way.
result.append("JNIEXPORT " + getJNIReturnType() + " JNICALL "
+ "Java_" + clazz.getMangledName() + "_" + getMangledName() + n);
result.append(" (JNIEnv *, ");
if (isStatic()) {
result.append("jclass");
} else {
result.append("jobject");
}
Type types[] = getArgumentTypes();
for (int i = 0; i < types.length; i++) {
result.append(", ");
result.append(ClazzMethod.getJNIType(types[i]));
}
result.append(");" + n);
result.append(n);
return result.toString();
}