Class ResultReturner

    • Constructor Detail

      • ResultReturner

        ResultReturner()
    • Method Detail

      • forOptionalReturn

        static ResultReturner forOptionalReturn​(java.lang.Class<?> extensionType,
                                                java.lang.reflect.Method method)
        If the return type is void, swallow results.
        Parameters:
        extensionType - The extension type to use.
        method - The method to use.
        Returns:
        A ResultReturner
        See Also:
        if the return type is not void
      • forMethod

        static ResultReturner forMethod​(java.lang.Class<?> extensionType,
                                        java.lang.reflect.Method method)
        Inspect a Method for its return type, and choose a ResultReturner subclass that handles any container that might wrap the results.
        Parameters:
        extensionType - the type that owns the Method
        method - the method whose return type chooses the ResultReturner
        Returns:
        an instance that takes a ResultIterable and constructs the return value. Never null.
      • findConsumer

        static java.util.Optional<ResultReturner> findConsumer​(java.lang.reflect.Method method)
        Inspect a Method for a Consumer to execute for each produced row.
        Parameters:
        method - the method called
        Returns:
        a ResultReturner that invokes the consumer and does not return a value
      • reducedResult

        protected abstract java.lang.Object reducedResult​(java.util.stream.Stream<?> stream,
                                                          StatementContext ctx)
      • checkResult

        private static java.lang.Object checkResult​(java.lang.Object result,
                                                    QualifiedType<?> type)