org.powermock.reflect.internal.WhiteboxImpl.findConstructorOrThrowException()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.powermock.reflect.internal.WhiteboxImpl.findConstructorOrThrowException()方法的一些代码示例,展示了WhiteboxImpl.findConstructorOrThrowException()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhiteboxImpl.findConstructorOrThrowException()方法的具体详情如下:
包路径:org.powermock.reflect.internal.WhiteboxImpl
类名称:WhiteboxImpl
方法名:findConstructorOrThrowException

WhiteboxImpl.findConstructorOrThrowException介绍

[英]Finds and returns a certain constructor. If the constructor couldn't be found this method delegates to
[中]查找并返回某个构造函数。如果找不到构造函数,此方法将委托给

代码示例

代码示例来源:origin: org.powermock.api/powermock-api-support

/**
 * Returns the default constructor specified in declaringClass.
 * 
 * @param declaringClass
 *            The declaringClass of the class where the constructor is
 *            located.
 * @return A <code>java.lang.reflect.Constructor</code>.
 * @throws TooManyConstructorsFoundException
 *             If more than one constructor was present in
 *             <code>declaringClass</code>
 */
@SuppressWarnings("unchecked")
public static <T> Constructor<T> constructor(Class<T> declaringClass) {
  return (Constructor<T>) WhiteboxImpl.findConstructorOrThrowException(declaringClass);
}

代码示例来源:origin: org.powermock/powermock-api-support

/**
 * Returns any one constructor specified in declaringClass. Is is useful when you only have ONE constructor
 * declared in {@code declaringClass} but you don't care which parameters it take.
 * 
 * @param declaringClass
 *            The declaringClass of the class where the constructor is
 *            located.
 * @return A {@code java.lang.reflect.Constructor}.
 * @throws TooManyConstructorsFoundException
 *             If more than one constructor was present in
 *             {@code declaringClass}
 */
@SuppressWarnings("unchecked")
public static <T> Constructor<T> constructor(Class<T> declaringClass) {
  return (Constructor<T>) WhiteboxImpl.findConstructorOrThrowException(declaringClass);
}

相关文章

WhiteboxImpl类方法