Skip to content

Commit

Permalink
Fixed javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Schönborn committed Apr 11, 2018
1 parent 7402768 commit a00e09c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public abstract class AbstractCancelableCompletableFuture<T> extends Completable
* by such methods.
*
* http://www.baeldung.com/java-9-completablefuture
*
* @param <U> generic future return type
* @return a new incomplete future to be used when constructing a dependent future
*/
// TODO (Java 9): @Override
public <U> CompletableFuture<U> newIncompleteFuture() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.concurrent.CompletionException;

/**
* @see org.zalando.riptide.capture.Completion
* @see "org.zalando.riptide.capture.Completion"
*/
@Deprecated//(since = "2.5.0", forRemoval = true)
public final class Completion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public interface FaultClassifier {
* @param throwable the throwable
* @param <T> generic return type
* @return never, always throws
* @throws Throwable either argument or wrapped argument
*/
default <T> T classifyExceptionally(final Throwable throwable) throws Throwable {
throw classify(throwable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,23 @@
import java.util.List;
import java.util.stream.Stream;

import static java.nio.charset.StandardCharsets.UTF_8;

/**
* Main entry point for <b>Riptide Streams</b> extension to capture arbitrary infinite object streams. It allows to
* receive infinite streams using application/x-json-stream and application/json-seq format, as well as simple finite
* streams from lists and arrays. The feature must be enabled by registering the {@link StreamConverter} with Riptide
* (using {@link Streams#streamConverter(ObjectMapper)} and declare a route for your stream that is calling a the stream consumer
* as follows:
*
* <pre>
* <pre>{@code
* try (Http http = Http.builder().baseUrl("https://api.github.com").converter(streamConverter()).build()) {
* http.get("/repos/{org}/{repo}/contributors", "zalando", "riptide")
* .accept(MediaType.APPLICATION_JSON)
* .dispatch(series(),
* on(SUCCESSFUL).call(streamOf(User.class),
* forEach(user -> println(user.login + " (" + user.contributions + ")"))))
* forEach(user -&gt; println(user.login + " (" + user.contributions + ")"))))
* .get();
* }
* </pre>
* }</pre>
*
* <b>Note:</b> The stream converter is an replacement to the default spring JSON converter that does not support
* streaming, and thus should be not registered together with it.
Expand All @@ -41,12 +39,13 @@ public final class Streams {

/**
* Creates specialized stream {@link TypeToken type token} for the given element {@link Class class type}. Used to
* declare the expected stream response {@link TypeToken type token} in Riptide {@link org.zalando.riptide.Route route} as follows:
* declare the expected stream response {@link TypeToken type token} in Riptide route as follows:
*
* <pre>
* on(...).call(streamOf(Result.class),...)
* </pre>
*
*
* @param <T> generic stream element type
* @param type element class type.
* @return stream token type.
*/
Expand All @@ -56,12 +55,13 @@ public static <T> TypeToken<Stream<T>> streamOf(final Class<T> type) {

/**
* Creates specialized stream {@link TypeToken type token} for the given element {@link TypeToken type token}. Used
* to declare the expected stream response {@link TypeToken type token} in Riptide {@link org.zalando.riptide.Route route} as follows:
* to declare the expected stream response {@link TypeToken type token} in Riptide org.zalando.riptide.Route route} as follows:
*
* <pre>
* on(...).call(streamOf(resultTypeToken),...)
* </pre>
*
*
* @param <T> generic stream element type
* @param type element token type.
* @return stream token type.
*/
Expand All @@ -85,7 +85,9 @@ public static <T> TypeToken<Stream<T>> streamOf(final TypeToken<T> type) {
* <pre>
* on(...).call(streamOf(...), forEach(System.out::println))
* </pre>
*
*
* @param <I> generic stream element type
* @param <X> generic exception type
* @param consumer element consumer function.
* @return stream consumer function.
*/
Expand All @@ -106,17 +108,18 @@ public static <I, X extends Throwable> ThrowingConsumer<Stream<I>, X> forEach(fi
/**
* Create default stream converter.
*
* @param <T> generic stream element type
* @return default stream converter.
*/
public static <T> StreamConverter<T> streamConverter() {
return streamConverter(new ObjectMapper());
}

/**
* Create stream converter with custom {@link ObjectMapper object mapper).
*
* Create stream converter with custom {@link ObjectMapper object mapper}.
*
* @param <T> generic stream element type
* @param mapper custom {@link ObjectMapper object mapper}.
*
* @return stream converter with customer object mapper.
*/
public static <T> StreamConverter<T> streamConverter(final ObjectMapper mapper) {
Expand All @@ -125,12 +128,12 @@ public static <T> StreamConverter<T> streamConverter(final ObjectMapper mapper)
}

/**
* Create stream converter with custom {@link ObjectMapper object mapper), and custom list of
* Create stream converter with custom {@link ObjectMapper object mapper}, and custom list of
* {@link MediaType supported media types}.
*
*
* @param <T> generic stream element type
* @param mapper custom {@link ObjectMapper object mapper}.
* @param supportedMediaTypes custom list of {@link MediaType media types}.
*
* @return stream converter with customer object mapper.
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static org.zalando.riptide.CancelableCompletableFuture.preserveCancelability;

/**
* @see CompletableFuture#orTimeout(long, TimeUnit)
* @see "CompletableFuture#orTimeout(long, TimeUnit)"
*/
@AllArgsConstructor
@ThisWouldBeOneLineIn(language = "Java 9", toWit = "return () -> execution.execute().orTimeout(timeout, unit)")
Expand Down

0 comments on commit a00e09c

Please sign in to comment.