Class MarshallingDirectives

    • Constructor Detail

      • MarshallingDirectives

        public MarshallingDirectives()
    • Method Detail

      • completeWith

        public <T> Route completeWith​(Marshaller<T,​? extends HttpResponse> marshaller,
                                      java.util.function.Consumer<java.util.function.Consumer<T>> inner)
        Uses the marshaller for the given type to produce a completion function that is passed to its inner function. You can use it do decouple marshaller resolution from request completion.
        Parameters:
        marshaller - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • entity

        public <T> Route entity​(Unmarshaller<? super HttpEntity,​T> unmarshaller,
                                java.util.function.Function<T,​Route> inner)
        Unmarshalls the requests entity using the given unmarshaller, and passes the result to [inner]. If there is a problem with unmarshalling the request is rejected with the Rejection produced by the unmarshaller.
        Parameters:
        unmarshaller - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • handleWith

        public <T,​R> Route handleWith​(Unmarshaller<? super HttpEntity,​T> unmarshaller,
                                            Marshaller<R,​? extends HttpResponse> marshaller,
                                            java.util.function.Function<T,​R> inner)
        Completes the request using the given function. The input to the function is produced with the in-scope entity unmarshaller and the result value of the function is marshalled with the in-scope marshaller.
        Parameters:
        unmarshaller - (undocumented)
        marshaller - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)
      • request

        public <T> Route request​(Unmarshaller<? super HttpRequest,​T> unmarshaller,
                                 java.util.function.Function<T,​Route> inner)
        Unmarshalls the request using the given unmarshaller, and passes the result to [inner]. If there is a problem with unmarshalling the request is rejected with the Rejection produced by the unmarshaller.
        Parameters:
        unmarshaller - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)