ReflectionExt { public static boolean isObjectMethod(Method method) { for (Pair<String, Class<?>[]> objectMethod : OBJECT_METHODS) { Class<?>[] objectMethodArgs = objectMethod.getRight(); if (method.getName().equals(objectMethod.getLeft()) && method.getParameterCount() == objectMethodArgs.length) { boolean allMatch = true; for (int i = 0; i < method.getParameterCount() && allMatch; i++) { allMatch = method.getParameterTypes()[i] == objectMethodArgs[i]; } if (allMatch) { return true; } } } return false; } private  ReflectionExt(); static boolean isPrimitiveOrWrapper(Class<?> type); static boolean isStandardDataType(Class<?> type); static boolean isContainerType(Field field); static boolean isNumeric(Class<?> type); static boolean isObjectMethod(Method method); static List<Class<?>> findAllInterfaces(Class<?> type); static List<Method> findAnnotatedMethods(T instance, Class<A> methodAnnotation); static Optional<StackTraceElement> findCallerStackTrace(); static Optional<Method> findInterfaceMethod(Method method); static Field getField(Class<?> type, String name); static T getFieldValue(Field field, Object object); static List<Field> getAllFields(Class<?> type); static Object invokeDefault(Object proxy, Class<?> apiInterface, Method method, Object[] args);  }
@Test public void testIsObjectMethod() { MyServiceImpl service = new MyServiceImpl(); for (Method method : service.getClass().getMethods()) { if (SERVICE_METHOD_NAMES.contains(method.getName())) { assertThat(ReflectionExt.isObjectMethod(method)).describedAs("Service method: %s", method).isFalse(); } else { assertThat(ReflectionExt.isObjectMethod(method)).isTrue(); } } }