Interface Reader<R>

Type Parameters:
R - the requested type
All Superinterfaces:
BiFunction<Flow.Publisher<DataChunk>,Class<? super R>,CompletionStage<? extends R>>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @Deprecated public interface Reader<R> extends BiFunction<Flow.Publisher<DataChunk>,Class<? super R>,CompletionStage<? extends R>>
Deprecated.
since 2.0.0, use io.helidon.media.common.MessageBodyReader instead
The Reader transforms a DataChunk publisher into a completion stage of the associated type.
  • Method Details

    • apply

      CompletionStage<? extends R> apply(Flow.Publisher<DataChunk> publisher, Class<? super R> clazz)
      Deprecated.
      Transforms a publisher into a completion stage. If an exception is thrown, the resulting completion stage of Content.as(Class) method call ends exceptionally.
      Specified by:
      apply in interface BiFunction<Flow.Publisher<DataChunk>,Class<? super R>,CompletionStage<? extends R>>
      Parameters:
      publisher - the publisher to transform
      clazz - the requested type to be returned as a completion stage. The purpose of this parameter is to know what the user of this Reader actually requested.
      Returns:
      the result as a completion stage
    • apply

      default CompletionStage<? extends R> apply(Flow.Publisher<DataChunk> publisher)
      Deprecated.
      Transforms a publisher into a completion stage. If an exception is thrown, the resulting completion stage of Content.as(Class) method call ends exceptionally.

      The default implementation calls apply(Flow.Publisher, Class) with Object as the class parameter.

      Parameters:
      publisher - the publisher to transform
      Returns:
      the result as a completion stage
    • applyAndCast

      default <T extends R> CompletionStage<? extends T> applyAndCast(Flow.Publisher<DataChunk> publisher, Class<T> type)
      Deprecated.
      Transforms a publisher into a completion stage. If an exception is thrown, the resulting completion stage of Content.as(Class) method call ends exceptionally.

      The default implementation calls apply(Flow.Publisher, Class) with Object as the class parameter.

      Type Parameters:
      T - the desired type to cast the guarantied R type to
      Parameters:
      publisher - the publisher to transform
      type - the desired type to cast the guarantied R type to
      Returns:
      the result as a completion stage which might end exceptionally with ClassCastException if the R type wasn't possible to cast to T