Class SerializingMethodInvoker
- java.lang.Object
-
- de.quantummaid.eventmaid.useCases.useCaseAdapter.methodInvoking.SerializingMethodInvoker
-
- All Implemented Interfaces:
UseCaseMethodInvoker
public final class SerializingMethodInvoker extends Object implements UseCaseMethodInvoker
AUseCaseMethodInvoker, that uses theDeserializerto deserialized the event into parameters of the use case method. TheSerializeris used to serialize the return value back into aMap.
-
-
Constructor Summary
Constructors Constructor Description SerializingMethodInvoker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectinvoke(Object useCase, Object event, Deserializer requestDeserializer, Serializer responseSerializer, ParameterInjector parameterInjector)Takes the use case instance and the current event to invoke the method on the use case instance.static SerializingMethodInvokerserializingMethodInvoker(Method method)Factory method to create a newSerializingMethodInvoker.
-
-
-
Method Detail
-
serializingMethodInvoker
public static SerializingMethodInvoker serializingMethodInvoker(Method method)
Factory method to create a newSerializingMethodInvoker.- Parameters:
method- themethodto invoke- Returns:
- the newly created
SerializingMethodInvokerobject
-
invoke
public Object invoke(Object useCase, Object event, Deserializer requestDeserializer, Serializer responseSerializer, ParameterInjector parameterInjector) throws Exception
Description copied from interface:UseCaseMethodInvokerTakes the use case instance and the current event to invoke the method on the use case instance. TheDeserializeris used to deserialize the event into the parameters of the method. The method's return value is deserialized with theSerializer.- Specified by:
invokein interfaceUseCaseMethodInvoker- Parameters:
useCase- the use case instanceevent- the request messagerequestDeserializer- theDeserializerfor the parametersresponseSerializer- theSerializerfor the return valueparameterInjector- the configuredParameterInjectorwith all injections- Returns:
- the serialized return value as
Map - Throws:
MethodInvocationException- when the method cannot be invokedClassCastException- when the event is not a validMapof type<String, Object>Exception- all exceptions declared by the use case method are rethrown
-
-