public class DummyInvocationUtils extends Object
Constructor and Description |
---|
DummyInvocationUtils() |
Modifier and Type | Method and Description |
---|---|
static LastInvocationAware |
getLastInvocationAware(Class<?> type,
Method method,
Object[] parameters)
Creates a simple
LastInvocationAware from the given type, method and parameters. |
static LastInvocationAware |
getLastInvocationAware(Method method,
Object[] parameters)
Creates a simple
LastInvocationAware for the given method and parameters. |
static LastInvocationAware |
getLastInvocationAware(Object source)
Returns the
LastInvocationAware instance from the given source, that essentially has to be a proxy created
via methodOn(Class, Object...) and subsequent linkTo(…) calls. |
static <T> T |
methodOn(Class<T> type,
Object... parameters)
Returns a proxy of the given type, backed by an
EmptyTargetSource to simply drop method invocations but
equips it with an InvocationRecordingMethodInterceptor . |
public static <T> T methodOn(Class<T> type, Object... parameters)
EmptyTargetSource
to simply drop method invocations but
equips it with an InvocationRecordingMethodInterceptor
. The interceptor records the last invocation and
returns a proxy of the return type that also implements LastInvocationAware
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.type
- must not be null.parameters
- parameters to extend template variables in the type level mapping.@Nullable public static LastInvocationAware getLastInvocationAware(Object source)
LastInvocationAware
instance from the given source, that essentially has to be a proxy created
via methodOn(Class, Object...)
and subsequent linkTo(…)
calls.source
- must not be null.public static LastInvocationAware getLastInvocationAware(Method method, Object[] parameters)
LastInvocationAware
for the given method and parameters.method
- must not be null.parameters
- must not be null.public static LastInvocationAware getLastInvocationAware(Class<?> type, Method method, Object[] parameters)
LastInvocationAware
from the given type, method and parameters.type
- must not be null.method
- must not be null.parameters
- must not be null.Copyright © 2011–2021 Pivotal, Inc.. All rights reserved.