Class ApiConsumerHelper


  • public final class ApiConsumerHelper
    extends Object
    Utility class for API Consumers.
    • Method Detail

      • findMethod

        public static <E extends Enum<E> & ApiName,​T> ApiMethod findMethod​(AbstractApiEndpoint<E,​T> endpoint,
                                                                                 PropertyNamesInterceptor propertyNamesInterceptor)
        Utility method to find matching API Method for supplied endpoint's configuration properties.
        Type Parameters:
        E - ApiName enumeration.
        T - Component configuration class.
        Parameters:
        endpoint - endpoint for configuration properties.
        propertyNamesInterceptor - names interceptor for adapting property names, usually the consumer class itself.
        Returns:
        matching ApiMethod.
      • getResultsProcessed

        public static <T extends DefaultConsumer & ResultInterceptor> int getResultsProcessed​(T consumer,
                                                                                              Object result,
                                                                                              boolean splitResult)
                                                                                       throws Exception
        Utility method for Consumers to process API method invocation result.
        Type Parameters:
        T - Consumer class that extends DefaultConsumer and implements ResultInterceptor.
        Parameters:
        consumer - Consumer that wants to process results.
        result - result of API method invocation.
        splitResult - true if the Consumer wants to split result using ResultInterceptor.splitResult(Object) method.
        Returns:
        number of result exchanges processed.
        Throws:
        Exception - on error.