本文整理匯總了Java中java.lang.reflect.Executable.getParameterTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java Executable.getParameterTypes方法的具體用法?Java Executable.getParameterTypes怎麽用?Java Executable.getParameterTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.reflect.Executable
的用法示例。
在下文中一共展示了Executable.getParameterTypes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SignatureType
import java.lang.reflect.Executable; //導入方法依賴的package包/類
public SignatureType(Executable method) {
super(MethodDescriptor.Separator.NONE);
// Get parameters
Class<?>[] types = method.getParameterTypes();
String[] parameterTypes = new String[types.length];
for (int i = 0; i < types.length; i++) {
parameterTypes[i] = Utils.toJVMTypeSignature(types[i]);
}
// Get return value
String returnType;
if (method instanceof Method) {
returnType = Utils.toJVMTypeSignature(((Method) method)
.getReturnType());
} else if (method instanceof Constructor) {
// Constructor returns void in VM
returnType = Utils.toJVMTypeSignature(void.class);
} else {
throw new Error(String.format("TESTBUG: wrong type of executable "
+ "%s of class %s", method, method.getClass()));
}
// Create signature
setElement("(" + String.join("", parameterTypes)+ ")" + returnType);
regexp = element;
setPattern(MethodDescriptor.PatternType.EXACT);
separator = MethodDescriptor.Separator.NONE;
}
示例2: getParamProviders
import java.lang.reflect.Executable; //導入方法依賴的package包/類
private Provider<?>[] getParamProviders(final Key<?> key, final Executable executable, final Set<Key<?>> chain) {
final Class<?>[] paramClasses = executable.getParameterTypes();
final Type[] paramTypes = executable.getGenericParameterTypes();
final Annotation[][] annotations = executable.getParameterAnnotations();
final Provider<?>[] result = new Provider<?>[paramTypes.length];
for (int i = 0; i < paramTypes.length; ++i) {
result[i] = getParamProvider(key, paramClasses[i], paramTypes[i], annotations[i], chain);
}
return result;
}