Class AbstractHeaderGetter<T,​C>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <S> void forEach​(java.lang.String headerName, C carrier, S state, HeaderGetter.HeaderConsumer<T,​S> consumer)
      Calls the consumer for each header value with the given key until all entries have been processed or the action throws an exception.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractHeaderGetter

        public AbstractHeaderGetter()
    • Method Detail

      • forEach

        public <S> void forEach​(java.lang.String headerName,
                                C carrier,
                                S state,
                                HeaderGetter.HeaderConsumer<T,​S> consumer)
        Description copied from interface: HeaderGetter
        Calls the consumer for each header value with the given key until all entries have been processed or the action throws an exception.

        The third parameter lets callers pass in a stateful object to be modified with header values, so the HeaderGetter.HeaderConsumer implementation itself can be stateless and potentially reusable.

        Specified by:
        forEach in interface HeaderGetter<T,​C>
        Type Parameters:
        S - the type of the state object
        Parameters:
        headerName - the name of the header
        carrier - the object containing the headers
        state - the object to be passed as the second parameter to each invocation on the specified consumer
        consumer - the action to be performed for each header value