private static Class<?> findExpectedType(final Class<?> fromClass) { for (Class<?> c = fromClass; c != Object.class; c = c.getSuperclass()) { for (final Method method : c.getDeclaredMethods()) { if (isSatisfiesSafelyMethod(method)) { return method.getParameterTypes()[0]; } } } throw new Error("Cannot determine correct type for satisfiesSafely() method."); }
private static Class<?> findExpectedType(final Class<?> fromClass) { for (Class<?> c = fromClass; c != Object.class; c = c.getSuperclass()) { for (final Method method : c.getDeclaredMethods()) { if (isSatisfiesSafelyMethod(method)) { return method.getParameterTypes()[0]; } } } throw new Error("Cannot determine correct type for satisfiesSafely() method."); }