Class SerializingMethodInvoker

    • Constructor Detail

      • SerializingMethodInvoker

        public SerializingMethodInvoker()
    • Method Detail

      • serializingMethodInvoker

        public static SerializingMethodInvoker serializingMethodInvoker​(Method method)
        Factory method to create a new SerializingMethodInvoker.
        Parameters:
        method - the method to invoke
        Returns:
        the newly created SerializingMethodInvoker object
      • invoke

        public Object invoke​(Object useCase,
                             Object event,
                             Deserializer requestDeserializer,
                             Serializer responseSerializer,
                             ParameterInjector parameterInjector)
                      throws Exception
        Description copied from interface: UseCaseMethodInvoker
        Takes the use case instance and the current event to invoke the method on the use case instance. The Deserializer is used to deserialize the event into the parameters of the method. The method's return value is deserialized with the Serializer.
        Specified by:
        invoke in interface UseCaseMethodInvoker
        Parameters:
        useCase - the use case instance
        event - the request message
        requestDeserializer - the Deserializer for the parameters
        responseSerializer - the Serializer for the return value
        parameterInjector - the configured ParameterInjector with all injections
        Returns:
        the serialized return value as Map
        Throws:
        MethodInvocationException - when the method cannot be invoked
        ClassCastException - when the event is not a valid Map of type <String, Object>
        Exception - all exceptions declared by the use case method are rethrown