cucumber.runtime.Utils Maven / Gradle / Ivy
package cucumber.runtime;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Utils {
private Utils() {
}
public static boolean isInstantiable(Class> clazz) {
boolean isNonStaticInnerClass = !Modifier.isStatic(clazz.getModifiers()) && clazz.getEnclosingClass() != null;
return Modifier.isPublic(clazz.getModifiers()) && !Modifier.isAbstract(clazz.getModifiers()) && !isNonStaticInnerClass;
}
public static Object invoke(final Object target, final Method method, long timeoutMillis, final Object... args) throws Throwable {
final Method targetMethod = targetMethod(target, method);
return Timeout.timeout(new Timeout.Callback