Class DummyInvocationUtils
java.lang.Object
org.springframework.hateoas.server.core.DummyInvocationUtils
Utility methods to capture dummy method invocations.
- Author:
- Oliver Gierke
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LastInvocationAware
getLastInvocationAware
(Class<?> type, Method method, Object[] parameters) Creates a simpleLastInvocationAware
from the given type, method and parameters.static LastInvocationAware
getLastInvocationAware
(Object source) Returns theLastInvocationAware
instance from the given source, that essentially has to be a proxy created viamethodOn(Class, Object...)
and subsequentlinkTo(…)
calls.static LastInvocationAware
getLastInvocationAware
(Method method, Object[] parameters) Creates a simpleLastInvocationAware
for the given method and parameters.static <T> T
Returns a proxy of the given type, backed by anEmptyTargetSource
to simply drop method invocations but equips it with anDummyInvocationUtils.InvocationRecordingMethodInterceptor
.static void
-
Constructor Details
-
DummyInvocationUtils
public DummyInvocationUtils()
-
-
Method Details
-
methodOn
Returns a proxy of the given type, backed by anEmptyTargetSource
to simply drop method invocations but equips it with anDummyInvocationUtils.InvocationRecordingMethodInterceptor
. The interceptor records the last invocation and returns a proxy of the return type that also implementsLastInvocationAware
so that the last method invocation can be inspected. Parameters passed to the subsequent method invocation are generally neglected except the ones that might be mapped into the URI translation eventually, e.g.PathVariable
in the case of Spring MVC. Note, that the return types of the methods have to be capable to be proxied.- Parameters:
type
- must not be null.parameters
- parameters to extend template variables in the type level mapping.- Returns:
-
getLastInvocationAware
Returns theLastInvocationAware
instance from the given source, that essentially has to be a proxy created viamethodOn(Class, Object...)
and subsequentlinkTo(…)
calls.- Parameters:
source
- must not be null.- Returns:
-
getLastInvocationAware
Creates a simpleLastInvocationAware
for the given method and parameters.- Parameters:
method
- must not be null.parameters
- must not be null.- Returns:
- will never be null.
- Since:
- 1.3.4
-
getLastInvocationAware
public static LastInvocationAware getLastInvocationAware(Class<?> type, Method method, Object[] parameters) Creates a simpleLastInvocationAware
from the given type, method and parameters.- Parameters:
type
- must not be null.method
- must not be null.parameters
- must not be null.- Returns:
- will never be null.
- Since:
- 1.3.4
-
resetCache
public static void resetCache()
-