From b27eb5c69dc0d32277088ea80d0ad2a7a5de1d5b Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Fri, 6 May 2016 07:46:47 +0200 Subject: [PATCH] Minor javadoc fixes --- .../src/main/java/com/google/cloud/AsyncPage.java | 5 +++-- .../main/java/com/google/cloud/AsyncPageImpl.java | 5 +++-- .../java/com/google/cloud/pubsub/SubscriptionId.java | 4 ++-- .../com/google/cloud/pubsub/SubscriptionInfo.java | 12 ++++++------ .../main/java/com/google/cloud/pubsub/TopicId.java | 5 +++-- .../main/java/com/google/cloud/pubsub/TopicInfo.java | 4 ++-- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/gcloud-java-core/src/main/java/com/google/cloud/AsyncPage.java b/gcloud-java-core/src/main/java/com/google/cloud/AsyncPage.java index d82d46f19b2d..8d7ff026e70d 100644 --- a/gcloud-java-core/src/main/java/com/google/cloud/AsyncPage.java +++ b/gcloud-java-core/src/main/java/com/google/cloud/AsyncPage.java @@ -37,7 +37,7 @@ * for (T value : page.values()) { * // do something with value * } - * page = page.nextPage().get(); + * page = page.nextPageAsync().get(); * }} * * @param the value type that the page holds @@ -45,7 +45,8 @@ public interface AsyncPage extends Page { /** - * Returns a {@link Future} object for the next page. + * Returns a {@link Future} object for the next page. {@link Future#get()} returns {@code null} if + * the last page has been reached. */ Future> nextPageAsync(); } diff --git a/gcloud-java-core/src/main/java/com/google/cloud/AsyncPageImpl.java b/gcloud-java-core/src/main/java/com/google/cloud/AsyncPageImpl.java index 42af7b34a943..706316e362cd 100644 --- a/gcloud-java-core/src/main/java/com/google/cloud/AsyncPageImpl.java +++ b/gcloud-java-core/src/main/java/com/google/cloud/AsyncPageImpl.java @@ -17,6 +17,7 @@ package com.google.cloud; import com.google.common.base.Throwables; +import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Uninterruptibles; import java.io.Serializable; @@ -47,7 +48,7 @@ private static class SyncNextPageFetcher implements PageImpl.NextPageFetcher< private static final long serialVersionUID = -4124568632363525351L; - private NextPageFetcher asyncPageFetcher; + private final NextPageFetcher asyncPageFetcher; private SyncNextPageFetcher(NextPageFetcher asyncPageFetcher) { this.asyncPageFetcher = asyncPageFetcher; @@ -75,7 +76,7 @@ public AsyncPageImpl(NextPageFetcher asyncPageFetcher, String cursor, Iterabl @Override public Future> nextPageAsync() { if (nextPageCursor() == null || asyncPageFetcher == null) { - return null; + return Futures.immediateCheckedFuture(null); } return asyncPageFetcher.nextPage(); } diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionId.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionId.java index 90cdc32e72ee..d083ecd04f26 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionId.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionId.java @@ -28,8 +28,8 @@ /** * Identity for a Google PubSub subscription. {@code SubscriptionId} objects are returned by the * {@link PubSub#listSubscriptions(String, PubSub.ListOption...)} and - * {@link PubSub#listSubscriptionsAsync(String, PubSub.ListOption...)} methods as the same topic - * can be used by subscriptions in different projects. + * {@link PubSub#listSubscriptionsAsync(String, PubSub.ListOption...)} methods as a topic may have + * subscriptions from different projects. */ public class SubscriptionId implements Serializable { diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionInfo.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionInfo.java index 2edb8ccf4654..cfed0e394569 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionInfo.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/SubscriptionInfo.java @@ -291,7 +291,7 @@ public Builder toBuilder() { * letters ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores * ({@code _}), periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs * ({@code %}). It must be between 3 and 255 characters in length and cannot begin with the - * string {@code goog} + * string {@code goog}. */ public static SubscriptionInfo of(String topic, String name) { return builder(topic, name).build(); @@ -307,7 +307,7 @@ public static SubscriptionInfo of(String topic, String name) { * letters ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores * ({@code _}), periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs * ({@code %}). It must be between 3 and 255 characters in length and cannot begin with the - * string {@code goog} + * string {@code goog}. */ public static SubscriptionInfo of(TopicId topic, String name) { return builder(topic, name).build(); @@ -323,7 +323,7 @@ public static SubscriptionInfo of(TopicId topic, String name) { * letters ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores * ({@code _}), periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs * ({@code %}). It must be between 3 and 255 characters in length and cannot begin with the - * string {@code goog} + * string {@code goog}. * @param endpoint a URL locating the endpoint to which messages should be pushed. For example, * an endpoint might use {@code https://example.com/push}. */ @@ -341,7 +341,7 @@ public static SubscriptionInfo of(String topic, String name, String endpoint) { * letters ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores * ({@code _}), periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs * ({@code %}). It must be between 3 and 255 characters in length and cannot begin with the - * string {@code goog} + * string {@code goog}. * @param endpoint a URL locating the endpoint to which messages should be pushed. For example, * an endpoint might use {@code https://example.com/push}. */ @@ -359,7 +359,7 @@ public static SubscriptionInfo of(TopicId topic, String name, String endpoint) { * letters ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores * ({@code _}), periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs * ({@code %}). It must be between 3 and 255 characters in length and cannot begin with the - * string {@code goog} + * string {@code goog}. */ public static Builder builder(String topic, String name) { return builder(TopicId.of(topic), name); @@ -375,7 +375,7 @@ public static Builder builder(String topic, String name) { * letters ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores * ({@code _}), periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs * ({@code %}). It must be between 3 and 255 characters in length and cannot begin with the - * string {@code goog} + * string {@code goog}. */ public static Builder builder(TopicId topic, String name) { return new BuilderImpl(topic, name); diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java index 99c8eda43f99..eefe505f3611 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java @@ -28,7 +28,7 @@ /** * Identity for a Google PubSub topic. A {@code TopicId} object can be used to create subscriptions - * for topics, possibly residing on a different project. + * for topics that possibly reside in different projects. */ public final class TopicId implements Serializable { @@ -43,7 +43,8 @@ private TopicId(String project, String topic) { } /** - * Returns the name of the project where the topic resides. + * Returns the name of the project where the topic resides. If {@code null} the topic is assumed + * to reside in the {@link PubSubOptions#projectId()} project. */ public String project() { return project; diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicInfo.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicInfo.java index acc5fbbd41ee..8c90a0c2705d 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicInfo.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicInfo.java @@ -140,7 +140,7 @@ public Builder toBuilder() { * ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores ({@code _}), * periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs ({@code %}). * It must be between 3 and 255 characters in length and cannot begin with the string - * {@code goog} + * {@code goog}. */ public static TopicInfo of(String name) { return builder(name).build(); @@ -153,7 +153,7 @@ public static TopicInfo of(String name) { * ({@code [A-Za-z]}), numbers ({@code [0-9]}), dashes ({@code -}), underscores ({@code _}), * periods ({@code .}), tildes ({@code ~}), plus ({@code +}) or percent signs ({@code %}). * It must be between 3 and 255 characters in length and cannot begin with the string - * {@code goog} + * {@code goog}. */ public static Builder builder(String name) { return new BuilderImpl(name);