I have this old hateos code which I would like to migrate to latest Spring hateos version
import org.springframework.hateoas.core.DummyInvocationUtils;
public LinkBuilder linkTo(Object dummyInvocation) {
if (!(dummyInvocation instanceof DummyInvocationUtils.InvocationRecordingMethodInterceptor)) {
IllegalArgumentException cause =
new IllegalArgumentException("linkTo(Object) must be call with a dummyInvocation");
throw InternalErrorException.builder()
.cause(cause)
.build();
}
DummyInvocationUtils.LastInvocationAware lastInvocationAware =
(DummyInvocationUtils.LastInvocationAware) dummyInvocation;
DummyInvocationUtils.MethodInvocation methodInvocation = lastInvocationAware.getLastInvocation();
StaticPathLinkBuilder staticPathLinkBuilder = getThis();
return staticPathLinkBuilder.linkTo(methodInvocation.getMethod(), methodInvocation.getArguments());
}
I can't find how to replace InvocationRecordingMethodInterceptor, LastInvocationAware and MethodInvocation in order to use the latest version of hateos. Can you give me advise how to fix this code?