public class ReflectiveOperationInvoker extends Object implements OperationInvoker
OperationInvoker
that invokes an operation using reflection.Constructor and Description |
---|
ReflectiveOperationInvoker(Object target,
Method method,
ParameterMapper parameterMapper)
Creates a new {code ReflectiveOperationInvoker} that will invoke the given
method on the given target . |
ReflectiveOperationInvoker(Object target,
Method method,
ParameterMapper parameterMapper,
org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer)
Creates a new {code ReflectiveOperationInvoker} that will invoke the given
method on the given target . |
Modifier and Type | Method and Description |
---|---|
Method |
getMethod()
Return the method that will be called on invocation.
|
<T> List<T> |
getParameters(BiFunction<String,Parameter,T> mapper)
Return the parameters of the method mapped using the given function.
|
Object |
invoke(Map<String,Object> arguments)
Invoke the underlying operation using the given
arguments . |
public ReflectiveOperationInvoker(Object target, Method method, ParameterMapper parameterMapper)
method
on the given target
. The given parameterMapper
will
be used to map parameters to the required types and the given
parameterNameMapper
will be used map parameters by name.target
- the target of the reflective callmethod
- the method to callparameterMapper
- the parameter mapperpublic ReflectiveOperationInvoker(Object target, Method method, ParameterMapper parameterMapper, org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer)
method
on the given target
. The given parameterMapper
will
be used to map parameters to the required types and the given
parameterNameMapper
will be used map parameters by name.target
- the target of the reflective callmethod
- the method to callparameterMapper
- the parameter mapperparameterNameDiscoverer
- the parameter name discovererpublic Method getMethod()
public <T> List<T> getParameters(BiFunction<String,Parameter,T> mapper)
T
- the mapped typemapper
- a mapper BiFunction
taking the discovered name and parameter
as input and returning the mapped type.public Object invoke(Map<String,Object> arguments)
OperationInvoker
arguments
.invoke
in interface OperationInvoker
arguments
- the arguments to pass to the operationnull
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.