class SimpleMethodInvoker implements MethodInvoker {

	private final Object object;

	private Method method;

	public SimpleMethodInvoker(Object object, Method method) {
		Assert.notNull(object, "Object to invoke must not be null");
		Assert.notNull(method, "Method to invoke must not be null");
		this.method = method;
		this.object = object;
	}

	public SimpleMethodInvoker(Object object, String methodName, Class<?>... paramTypes) {
		Assert.notNull(object, "Object to invoke must not be null");
		this.method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, paramTypes);
		if (this.method == null) {
			// try with no params
			this.method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName);
		}
		if (this.method == null) {
			throw new IllegalArgumentException("No methods found for name: [" + methodName + "] in class: ["
					+ object.getClass() + "] with arguments of type: [" + Arrays.toString(paramTypes) + "]");
		}
		this.object = object;
	}

	@Nullable
	@Override
	public Object invokeMethod(Object... args) {

		Class<?>[] parameterTypes = method.getParameterTypes();
		Object[] invokeArgs;
		if (parameterTypes.length == 0) {
			invokeArgs = new Object[] {};
		}
		else if (parameterTypes.length != args.length) {
			throw new IllegalArgumentException(
					"Wrong number of arguments, expected no more than: [" + parameterTypes.length + "]");
		}
		else {
			invokeArgs = args;
		}

		method.setAccessible(true);

		try {
			// Extract the target from an Advised as late as possible
			// in case it contains a lazy initialization
			Object target = extractTarget(object, method);
			return method.invoke(target, invokeArgs);
		}
		catch (Exception e) {
			throw new IllegalArgumentException("Unable to invoke method: [" + method + "] on object: [" + object
					+ "] with arguments: [" + Arrays.toString(args) + "]", e);
		}
	}

	private Object extractTarget(Object target, Method method) {
		if (target instanceof Advised) {
			Object source;
			try {
				source = ((Advised) target).getTargetSource().getTarget();
			}
			catch (Exception e) {
				throw new IllegalStateException("Could not extract target from proxy", e);
			}
			if (source instanceof Advised) {
				source = extractTarget(source, method);
			}
			if (method.getDeclaringClass().isAssignableFrom(source.getClass())) {
				target = source;
			}
		}
		return target;
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof SimpleMethodInvoker rhs)) {
			return false;
		}

		if (obj == this) {
			return true;
		}
		return (rhs.method.equals(this.method)) && (rhs.object.equals(this.object));
	}

	@Override
	public int hashCode() {<FILL_FUNCTION_BODY>}

}

		int result = 25;
		result = 31 * result + object.hashCode();
		result = 31 * result + method.hashCode();
		return result;
	
<no_super_class>