本文整理匯總了Java中java.lang.reflect.Executable.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java Executable.getName方法的具體用法?Java Executable.getName怎麽用?Java Executable.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.reflect.Executable
的用法示例。
在下文中一共展示了Executable.getName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ClassVisitorForLabels
import java.lang.reflect.Executable; //導入方法依賴的package包/類
public ClassVisitorForLabels(ClassWriter cw, Map<Label, Integer> lines,
Executable target) {
super(Opcodes.ASM5, cw);
this.lineNumbers = lines;
StringBuilder builder = new StringBuilder("(");
for (Parameter parameter : target.getParameters()) {
builder.append(Utils.toJVMTypeSignature(parameter.getType()));
}
builder.append(")");
if (target instanceof Constructor) {
targetName = "<init>";
builder.append("V");
} else {
targetName = target.getName();
builder.append(Utils.toJVMTypeSignature(
((Method) target).getReturnType()));
}
targetDesc = builder.toString();
}
示例2: runSanityTest
import java.lang.reflect.Executable; //導入方法依賴的package包/類
private static void runSanityTest(Executable aMethod, int[] bcis) {
HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
String className = aMethod.getDeclaringClass().getName();
String methodName = aMethod.getName().equals(className)
? "<init>"
: aMethod.getName();
String fileName = getFileName(className);
Map<Integer, Integer> bciWithLineNumber = CTVMUtilities
.getBciToLineNumber(aMethod);
boolean isNative = Modifier.isNative(aMethod.getModifiers());
int lineNumber = -1;
for (int bci : bcis) {
StackTraceElement ste = CompilerToVMHelper
.getStackTraceElement(method, bci);
Asserts.assertNotNull(ste, aMethod + " : got null StackTraceElement"
+ " at bci " + bci);
Asserts.assertEQ(className, ste.getClassName(), aMethod
+ " : unexpected class name");
Asserts.assertEQ(fileName, ste.getFileName(), aMethod
+ " : unexpected filename");
Asserts.assertEQ(methodName, ste.getMethodName(), aMethod
+ " : unexpected method name");
Asserts.assertEQ(isNative, ste.isNativeMethod(), aMethod
+ " : unexpected 'isNative' value");
if (bciWithLineNumber.size() > 0) {
if (bciWithLineNumber.containsKey(bci)) {
lineNumber = bciWithLineNumber.get(bci);
}
Asserts.assertEQ(lineNumber, ste.getLineNumber(), aMethod
+ " : unexpected line number");
} else {
// native and abstract function
Asserts.assertGT(0, ste.getLineNumber(),
aMethod + " : unexpected line number for abstract "
+ "or native method");
}
}
}
示例3: MethodType
import java.lang.reflect.Executable; //導入方法依賴的package包/類
public MethodType(Executable method) {
// Use pack/subpack/Class::method separators style
super(MethodDescriptor.Separator.DOT);
if (method instanceof Constructor) {
element = "<init>";
} else {
element = method.getName();
}
regexp = element;
}