本文整理了Java中org.powermock.reflect.internal.WhiteboxImpl.getAllMethods()
方法的一些代码示例,展示了WhiteboxImpl.getAllMethods()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhiteboxImpl.getAllMethods()
方法的具体详情如下:
包路径:org.powermock.reflect.internal.WhiteboxImpl
类名称:WhiteboxImpl
方法名:getAllMethods
[英]Get all methods in a class hierarchy! Both declared an non-declared (no duplicates).
[中]获取类层次结构中的所有方法!两者都声明为未声明(无重复)。
代码示例来源:origin: org.powermock/powermock-reflect
/**
* Gets the all method except.
*
* @param <T> the generic type
* @param type the type
* @param methodNames the method names
* @return the all method except
*/
public static <T> Method[] getAllMethodExcept(Class<T> type, String... methodNames) {
List<Method> methodsToMock = new LinkedList<Method>();
Method[] methods = getAllMethods(type);
iterateMethods:
for (Method method : methods) {
for (String methodName : methodNames) {
if (method.getName().equals(methodName)) {
continue iterateMethods;
}
}
methodsToMock.add(method);
}
return methodsToMock.toArray(new Method[0]);
}
代码示例来源:origin: org.powermock.api/powermock-api-support
/**
* Get all methods in a class hierarchy of the supplied classes. Both
* declared an non-declared (no duplicates).
*
* @param cls
* The class whose methods to get.
* @param additionalClasses
* Additional classes whose methods to get.
* @return All methods declared in this class hierarchy.
*/
public static Method[] methodsDeclaredIn(final Class<?> cls, final Class<?>... additionalClasses) {
if (cls == null) {
throw new IllegalArgumentException("You need to supply at least one class.");
}
Set<Method> methods = new HashSet<Method>();
methods.addAll(asList(WhiteboxImpl.getAllMethods(cls)));
for (Class<?> klass : additionalClasses) {
methods.addAll(asList(WhiteboxImpl.getAllMethods(klass)));
}
return methods.toArray(new Method[methods.size()]);
}
代码示例来源:origin: org.powermock/powermock-api-support
/**
* Get all methods in a class hierarchy of the supplied classes. Both
* declared an non-declared (no duplicates).
*
* @param cls
* The class whose methods to get.
* @param additionalClasses
* Additional classes whose methods to get.
* @return All methods declared in this class hierarchy.
*/
public static Method[] methodsDeclaredIn(final Class<?> cls, final Class<?>... additionalClasses) {
if (cls == null) {
throw new IllegalArgumentException("You need to supply at least one class.");
}
Set<Method> methods = new HashSet<Method>();
methods.addAll(asList(WhiteboxImpl.getAllMethods(cls)));
for (Class<?> klass : additionalClasses) {
methods.addAll(asList(WhiteboxImpl.getAllMethods(klass)));
}
return methods.toArray(new Method[methods.size()]);
}
代码示例来源:origin: org.powermock.reflect/powermock-reflect
/**
* Gets the all method except.
*
* @param <T>
* the generic type
* @param type
* the type
* @param methodNames
* the method names
* @return the all method except
*/
public static <T> Method[] getAllMethodExcept(Class<T> type, String... methodNames) {
List<Method> methodsToMock = new LinkedList<Method>();
Method[] methods = getAllMethods(type);
iterateMethods: for (Method method : methods) {
for (String methodName : methodNames) {
if (method.getName().equals(methodName)) {
continue iterateMethods;
}
}
methodsToMock.add(method);
}
return methodsToMock.toArray(new Method[0]);
}
代码示例来源:origin: org.powermock.reflect/powermock-reflect
Method[] methods = getAllMethods(type);
List<Method> methodList = new ArrayList<Method>();
outer: for (Method method : methods) {
代码示例来源:origin: org.powermock/powermock-reflect
Method[] methods = getAllMethods(type);
List<Method> methodList = new ArrayList<Method>();
outer:
代码示例来源:origin: org.powermock/powermock-reflect
for (Method method : getAllMethods(type)) {
if (methodName == null || method.getName().equals(methodName)) {
if (parameterTypes != null && parameterTypes.length > 0) {
代码示例来源:origin: org.powermock/powermock-reflect
allMethods = getAllPublicMethods(clazz);
} else {
allMethods = getAllMethods(clazz);
代码示例来源:origin: org.powermock.reflect/powermock-reflect
allMethods = getAllPublicMethods(clazz);
} else {
allMethods = getAllMethods(clazz);
代码示例来源:origin: org.powermock.reflect/powermock-reflect
for (Method method : getAllMethods(type)) {
if (methodName == null || method.getName().equals(methodName)) {
if (parameterTypes != null && parameterTypes.length > 0) {
代码示例来源:origin: org.powermock.reflect/powermock-reflect
methods = getAllMethods(testedType);
} else {
methods = declaringClass.getDeclaredMethods();
代码示例来源:origin: org.powermock/powermock-reflect
methods = getAllMethods(testedType);
} else {
methods = declaringClass.getDeclaredMethods();
内容来源于网络,如有侵权,请联系作者删除!