本文整理汇总了Java中com.thoughtworks.paranamer.AnnotationParanamer类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationParanamer类的具体用法?Java AnnotationParanamer怎么用?Java AnnotationParanamer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationParanamer类属于com.thoughtworks.paranamer包,在下文中一共展示了AnnotationParanamer类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CodeGeneratorMethod
import com.thoughtworks.paranamer.AnnotationParanamer; //导入依赖的package包/类
public CodeGeneratorMethod(Method m) {
this.underlyingMethod = m;
this.methodName = m.getName();
this.returnType = m.getReturnType();
// Paranamer para = new BytecodeReadingParanamer();
Paranamer para = new AnnotationParanamer();
String[] parameterNames = para.lookupParameterNames(m, true);
if (parameterNames == null) {
throw new RuntimeException(String.format("Unable to read the parameter names for method %s. This is likely due to the class files not including the appropriate debugging information. Look up java -g for more information.", m));
}
Class<?>[] types = m.getParameterTypes();
if (parameterNames.length != types.length) {
throw new RuntimeException(String.format("Unexpected number of parameter names %s. Expected %s on method %s.", Arrays.toString(parameterNames), Arrays.toString(types), m.toGenericString()));
}
arguments = new CodeGeneratorArgument[parameterNames.length];
for (int i = 0 ; i < parameterNames.length; i++) {
arguments[i] = new CodeGeneratorArgument(parameterNames[i], types[i]);
}
exs = m.getExceptionTypes();
}