diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java index f06de0b27..30647c1d7 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GooglePlayServicesAvailabilityIOException.java @@ -26,18 +26,16 @@ *
Use {@link #getConnectionStatusCode()} to display the error dialog. Alternatively, use {@link * #getCause()} to get the wrapped {@link GooglePlayServicesAvailabilityException}. Example usage: * - *
+ ** * @since 1.12 * @author Yaniv Inbar diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java index 280d80f79..b1b6825dd 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/UserRecoverableAuthIOException.java @@ -26,12 +26,12 @@ *{@code * } catch (final GooglePlayServicesAvailabilityIOException availabilityException) { - * myActivity.runOnUiThread(new Runnable() { - * public void run() { - * Dialog dialog = GooglePlayServicesUtil.getErrorDialog( - * availabilityException.getConnectionStatusCode(), - * myActivity, - * MyActivity.REQUEST_GOOGLE_PLAY_SERVICES); - * dialog.show(); + * myActivity.runOnUiThread(new Runnable() { + * public void run() { + * Dialog dialog = GooglePlayServicesUtil.getErrorDialog( + * availabilityException.getConnectionStatusCode(), + * myActivity, MyActivity.REQUEST_GOOGLE_PLAY_SERVICES); + * dialog.show(); * } - * }); - *+ * }
Use {@link #getIntent()} to allow user interaction to recover. Alternatively, use {@link * #getCause()} to get the wrapped {@link UserRecoverableAuthException}. Example usage: * - *
+ ** * @since 1.12 * @author Yaniv Inbar diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java index cf2772af7..b1323b9b6 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/auth/oauth2/AppIdentityCredential.java @@ -41,13 +41,13 @@ * *{@code * } catch (UserRecoverableAuthIOException userRecoverableException) { - * myActivity.startActivityForResult( - * userRecoverableException.getIntent(), MyActivity.REQUEST_AUTHORIZATION); + * myActivity.startActivityForResult( + * userRecoverableException.getIntent(), MyActivity.REQUEST_AUTHORIZATION); * } - *+ * }
Sample usage: * - *
- * public static HttpRequestFactory createRequestFactory( - * HttpTransport transport, JsonFactory jsonFactory, TokenResponse tokenResponse) { - * return transport.createRequestFactory( - * new AppIdentityCredential("https://www.googleapis.com/auth/urlshortener")); + ** *{@code + * public static HttpRequestFactory createRequestFactory(HttpTransport transport, + * JsonFactory jsonFactory, TokenResponse tokenResponse) { + * return transport.createRequestFactory( + * new AppIdentityCredential("https://www.googleapis.com/auth/urlshortener")); * } - *+ * }
Implementation is immutable and thread-safe. * diff --git a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java index 22324aa86..c26dbf2bd 100644 --- a/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java +++ b/google-api-client-appengine/src/main/java/com/google/api/client/googleapis/extensions/appengine/notifications/AppEngineNotificationServlet.java @@ -37,7 +37,7 @@ * alternatively call that method instead from your {@link HttpServlet#doPost} with no loss of * functionality. Sample web.xml setup: * - *
+ ** * @author Yaniv Inbar * @since 1.16 diff --git a/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notifications/json/gson/GsonNotificationCallback.java b/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notifications/json/gson/GsonNotificationCallback.java index c22415f3e..0936b3e87 100644 --- a/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notifications/json/gson/GsonNotificationCallback.java +++ b/google-api-client-gson/src/main/java/com/google/api/client/googleapis/notifications/json/gson/GsonNotificationCallback.java @@ -29,32 +29,32 @@ * *{@code * {@literal <}servlet{@literal >} * {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >} * {@literal <}servlet-class{@literal >}com.google.api.client.googleapis.extensions.appengine.notifications.AppEngineNotificationServlet{@literal <}/servlet-class{@literal >} @@ -46,7 +46,7 @@ * {@literal <}servlet-name{@literal >}AppEngineNotificationServlet{@literal <}/servlet-name{@literal >} * {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >} * {@literal <}/servlet-mapping{@literal >} - *+ * }
Implementation should be thread-safe. Example usage: * - *
+ ** * @param{@code * static class MyNotificationCallback - * extends GsonNotificationCallback{@literal <}ListResponse{@literal >} { + * extends GsonNotificationCallback{@literal <}ListResponse{@literal >} { * - * private static final long serialVersionUID = 1L; + * private static final long serialVersionUID = 1L; * - * {@literal @}Override - * protected void onNotification( - * StoredChannel channel, TypedNotification{@literal <}ListResponse{@literal >} notification) { - * ListResponse content = notification.getContent(); - * switch (notification.getResourceState()) { - * case ResourceStates.SYNC: - * break; - * case ResourceStates.EXISTS: - * break; - * case ResourceStates.NOT_EXISTS: - * break; - * } - * } + * {@literal @}Override + * protected void onNotification(StoredChannel channel, + * TypedNotification{@literal <}ListResponse{@literal >} notification) { + * ListResponse content = notification.getContent(); + * switch (notification.getResourceState()) { + * case ResourceStates.SYNC: + * break; + * case ResourceStates.EXISTS: + * break; + * case ResourceStates.NOT_EXISTS: + * break; + * } + * } * - * {@literal @}Override - * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException { - * return ListResponse.class; - * } + * {@literal @}Override + * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException { + * return ListResponse.class; + * } * } - *+ * }
Implementation should be thread-safe. Example usage: * - *
+ ** * @param{@code * static class MyNotificationCallback - * extends JacksonNotificationCallback{@literal <}ListResponse{@literal >} { + * extends JacksonNotificationCallback{@literal <}ListResponse{@literal >} { * - * private static final long serialVersionUID = 1L; + * private static final long serialVersionUID = 1L; * - * {@literal @}Override - * protected void onNotification( - * StoredChannel channel, TypedNotification{@literal <}ListResponse{@literal >} notification) { - * ListResponse content = notification.getContent(); - * switch (notification.getResourceState()) { - * case ResourceStates.SYNC: - * break; - * case ResourceStates.EXISTS: - * break; - * case ResourceStates.NOT_EXISTS: - * break; - * } - * } + * {@literal @}Override + * protected void onNotification(StoredChannel channel, + * TypedNotification{@literal <}ListResponse{@literal >} notification) { + * ListResponse content = notification.getContent(); + * switch (notification.getResourceState()) { + * case ResourceStates.SYNC: + * break; + * case ResourceStates.EXISTS: + * break; + * case ResourceStates.NOT_EXISTS: + * break; + * } + * } * - * {@literal @}Override - * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException { - * return ListResponse.class; - * } + * {@literal @}Override + * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException { + * return ListResponse.class; + * } * } - *+ * }
Example usage: * - *
- * + ** * @param batchRequest batch request container * @param callback batch callback diff --git a/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/CommonGoogleProtoClientRequestInitializer.java b/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/CommonGoogleProtoClientRequestInitializer.java index 633cecc5c..c8bf4207d 100644 --- a/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/CommonGoogleProtoClientRequestInitializer.java +++ b/google-api-client-protobuf/src/main/java/com/google/api/client/googleapis/services/protobuf/CommonGoogleProtoClientRequestInitializer.java @@ -26,47 +26,47 @@ * *{@code * request.queue(batchRequest, new BatchCallback{@literal <}SomeResponseType, Void{@literal >}() { * - * public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) { - * log("Success"); - * } + * public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) { + * log("Success"); + * } * - * public void onFailure(Void unused, HttpHeaders responseHeaders) { - * log(e.getMessage()); - * } + * public void onFailure(Void unused, HttpHeaders responseHeaders) { + * log(e.getMessage()); + * } * }); - *+ * }
The simplest usage is to use it to set the key parameter: * - *
+ ** *{@code * public static final GoogleClientRequestInitializer KEY_INITIALIZER = - * new CommonGoogleProtoClientRequestInitializer(KEY); - *+ * new CommonGoogleProtoClientRequestInitializer(KEY); + * }
There is also a constructor to set both the key and userIp parameters: * - *
+ ** *{@code * public static final GoogleClientRequestInitializer INITIALIZER = - * new CommonGoogleProtoClientRequestInitializer(KEY, USER_IP); - *+ * new CommonGoogleProtoClientRequestInitializer(KEY, USER_IP); + * }
If you want to implement custom logic, extend it like this: * - *
+ ** *{@code * public static class MyRequestInitializer extends CommonGoogleProtoClientRequestInitializer { * - * {@literal @}Override - * public void initialize(AbstractGoogleProtoClientRequest{@literal <}?{@literal >} request) - * throws IOException { - * // custom logic + * {@literal @}Override + * public void initialize(AbstractGoogleProtoClientRequest{@literal <}?{@literal >} request) + * throws IOException { + * // custom logic + * } * } - * } - *+ * }
Finally, to set the key and userIp parameters and insert custom logic, extend it like this: * - *
+ ** *{@code * public static class MyKeyRequestInitializer extends CommonGoogleProtoClientRequestInitializer { * - * public MyKeyRequestInitializer() { - * super(KEY, USER_IP); - * } + * public MyKeyRequestInitializer() { + * super(KEY, USER_IP); + * } * - * {@literal @}Override - * public void initializeProtoRequest( - * AbstractGoogleProtoClientRequest{@literal <}?{@literal >} request) throws IOException { - * // custom logic - * } + * {@literal @}Override + * public void initializeProtoRequest( + * AbstractGoogleProtoClientRequest{@literal <}?{@literal >} request) throws IOException { + * // custom logic + * } * } - *+ * }
Subclasses should be thread-safe. * diff --git a/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/NotificationServlet.java b/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/NotificationServlet.java index 67f3ce2eb..6f1fd0188 100644 --- a/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/NotificationServlet.java +++ b/google-api-client-servlet/src/main/java/com/google/api/client/googleapis/extensions/servlet/notifications/NotificationServlet.java @@ -36,20 +36,20 @@ * may alternatively call that method instead from your {@link HttpServlet#doPost} with no loss of * functionality. Example usage: * - *
+ ** * Sample web.xml setup: * - *{@code * public class MyNotificationServlet extends NotificationServlet { * - * private static final long serialVersionUID = 1L; + * private static final long serialVersionUID = 1L; * - * public MyNotificationServlet() throws IOException { - * super(new SomeDataStoreFactory()); + * public MyNotificationServlet() throws IOException { + * super(new SomeDataStoreFactory()); + * } * } - * } - *+ * }
+ ** *{@code * {@literal <}servlet{@literal >} * {@literal <}servlet-name{@literal >}MyNotificationServlet{@literal <}/servlet-name{@literal >} * {@literal <}servlet-class{@literal >}com.mypackage.MyNotificationServlet{@literal <}/servlet-class{@literal >} @@ -58,7 +58,7 @@ * {@literal <}servlet-name{@literal >}MyNotificationServlet{@literal <}/servlet-name{@literal >} * {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >} * {@literal <}/servlet-mapping{@literal >} - *+ * }
WARNING: by default it uses {@link MemoryDataStoreFactory#getDefaultInstance()} which means it * will NOT persist the notification channels when the servlet process dies, so it is a BAD CHOICE @@ -66,7 +66,7 @@ * you don't need to override it, and can simply reference it directly in your web.xml file. For * example: * - *
+ ** * @author Yaniv Inbar * @since 1.16 diff --git a/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchContent.java b/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchContent.java index eb4bceff1..2d8f67047 100644 --- a/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchContent.java +++ b/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchContent.java @@ -29,14 +29,12 @@ * *{@code * {@literal <}servlet{@literal >} * {@literal <}servlet-name{@literal >}NotificationServlet{@literal <}/servlet-name{@literal >} * {@literal <}servlet-class{@literal >}com.google.api.client.googleapis.extensions.servlet.notificationsNotificationServlet{@literal <}/servlet-class{@literal >} @@ -75,7 +75,7 @@ * {@literal <}servlet-name{@literal >}NotificationServlet{@literal <}/servlet-name{@literal >} * {@literal <}url-pattern{@literal >}/notifications{@literal <}/url-pattern{@literal >} * {@literal <}/servlet-mapping{@literal >} - *+ * }
Sample usage: * - *
- *
+ * {@code
* static void setContent(
- * HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object patchEntry) {
- * request.setContent(new AtomPatchContent(namespaceDictionary, patchEntry));
+ * HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object patchEntry) {
+ * request.setContent(new AtomPatchContent(namespaceDictionary, patchEntry));
* }
- *
- *
+ * }
*
* Implementation is not thread-safe. * diff --git a/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchRelativeToOriginalContent.java b/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchRelativeToOriginalContent.java index 706d9e53f..c89045675 100644 --- a/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchRelativeToOriginalContent.java +++ b/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/AtomPatchRelativeToOriginalContent.java @@ -31,15 +31,14 @@ * *
Sample usage: * - *
- *
- * static void setContent(HttpRequest request, XmlNamespaceDictionary namespaceDictionary,
- * Object originalEntry, Object patchedEntry) {
- * request.setContent(
- * new AtomPatchRelativeToOriginalContent(namespaceDictionary, originalEntry, patchedEntry));
+ * {@code
+ * static void setContent(HttpRequest request,
+ * XmlNamespaceDictionary namespaceDictionary,
+ * Object originalEntry, Object patchedEntry) {
+ * request.setContent(new AtomPatchRelativeToOriginalContent(
+ * namespaceDictionary, originalEntry, patchedEntry));
* }
- *
- *
+ * }
*
* @since 1.0
* @author Yaniv Inbar
diff --git a/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/package-info.java b/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/package-info.java
index ae69d6f60..67082c535 100644
--- a/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/package-info.java
+++ b/google-api-client-xml/src/main/java/com/google/api/client/googleapis/xml/atom/package-info.java
@@ -40,7 +40,7 @@
* Let's take a look at a typical partial Atom XML album feed from the Picasa Web Albums Data * API: * - *
+ * {@code
* <?xml version='1.0' encoding='utf-8'?>
* <feed xmlns='http://www.w3.org/2005/Atom'
* xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
@@ -60,151 +60,150 @@
* <gphoto:access>public</gphoto:access>
* </entry>
* </feed>
- *
+ * }
*
* Here's one possible way to design the Java data classes for this (each class in its own Java * file): * - *
+ * {@code
* import com.google.api.client.util.*;
* import java.util.List;
*
* public class Link {
*
- * @Key("@href")
- * public String href;
- *
- * @Key("@rel")
- * public String rel;
- *
- * public static String find(List<Link> links, String rel) {
- * if (links != null) {
- * for (Link link : links) {
- * if (rel.equals(link.rel)) {
- * return link.href;
- * }
- * }
- * }
- * return null;
- * }
+ * @Key("@href")
+ * public String href;
+ *
+ * @Key("@rel")
+ * public String rel;
+ *
+ * public static String find(List<Link> links, String rel) {
+ * if (links != null) {
+ * for (Link link : links) {
+ * if (rel.equals(link.rel)) {
+ * return link.href;
+ * }
+ * }
+ * }
+ * return null;
+ * }
* }
*
* public class Category {
*
- * @Key("@scheme")
- * public String scheme;
+ * @Key("@scheme")
+ * public String scheme;
*
- * @Key("@term")
- * public String term;
+ * @Key("@term")
+ * public String term;
*
- * public static Category newKind(String kind) {
- * Category category = new Category();
- * category.scheme = "http://schemas.google.com/g/2005#kind";
- * category.term = "http://schemas.google.com/photos/2007#" + kind;
- * return category;
- * }
+ * public static Category newKind(String kind) {
+ * Category category = new Category();
+ * category.scheme = "http://schemas.google.com/g/2005#kind";
+ * category.term = "http://schemas.google.com/photos/2007#" + kind;
+ * return category;
+ * }
* }
*
* public class AlbumEntry {
*
- * @Key
- * public String summary;
+ * @Key
+ * public String summary;
*
- * @Key
- * public String title;
+ * @Key
+ * public String title;
*
- * @Key("gphoto:access")
- * public String access;
+ * @Key("gphoto:access")
+ * public String access;
*
- * public Category category = newKind("album");
+ * public Category category = newKind("album");
*
- * private String getEditLink() {
- * return Link.find(links, "edit");
- * }
+ * private String getEditLink() {
+ * return Link.find(links, "edit");
+ * }
* }
*
* public class Author {
*
- * @Key
- * public String name;
+ * @Key
+ * public String name;
* }
*
* public class AlbumFeed {
*
- * @Key
- * public Author author;
+ * @Key
+ * public Author author;
*
- * @Key("openSearch:totalResults")
- * public int totalResults;
+ * @Key("openSearch:totalResults")
+ * public int totalResults;
*
- * @Key("entry")
- * public List<AlbumEntry> photos;
+ * @Key("entry")
+ * public List<AlbumEntry> photos;
*
- * @Key("link")
- * public List<Link> links;
+ * @Key("link")
+ * public List<Link> links;
*
- * private String getPostLink() {
- * return Link.find(links, "http://schemas.google.com/g/2005#post");
- * }
+ * private String getPostLink() {
+ * return Link.find(links, "http://schemas.google.com/g/2005#post");
+ * }
* }
- *
+ * }
*
* You can also use the @{@link com.google.api.client.util.Key} annotation to defined query * parameters for a URL. For example: * - *
+ * {@code
* public class PicasaUrl extends GoogleUrl {
*
- * @Key("max-results")
- * public Integer maxResults;
+ * @Key("max-results")
+ * public Integer maxResults;
*
- * @Key
- * public String kinds;
+ * @Key
+ * public String kinds;
*
- * public PicasaUrl(String url) {
- * super(url);
- * }
+ * public PicasaUrl(String url) {
+ * super(url);
+ * }
*
- * public static PicasaUrl fromRelativePath(String relativePath) {
- * PicasaUrl result = new PicasaUrl(PicasaWebAlbums.ROOT_URL);
- * result.path += relativePath;
- * return result;
- * }
+ * public static PicasaUrl fromRelativePath(String relativePath) {
+ * PicasaUrl result = new PicasaUrl(PicasaWebAlbums.ROOT_URL);
+ * result.path += relativePath;
+ * return result;
+ * }
* }
- *
+ * }
*
* To work with a Google API, you first need to set up the {@link * com.google.api.client.http.HttpTransport}. For example: * - *
+ * {@code
* private static HttpTransport setUpTransport() throws IOException {
- * HttpTransport result = new NetHttpTransport();
- * GoogleUtils.useMethodOverride(result);
- * HttpHeaders headers = new HttpHeaders();
- * headers.setApplicationName("Google-PicasaSample/1.0");
- * headers.gdataVersion = "2";
- * AtomParser parser = new AtomParser();
- * parser.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
- * transport.addParser(parser);
- * // insert authentication code...
- * return transport;
+ * HttpTransport result = new NetHttpTransport();
+ * GoogleUtils.useMethodOverride(result);
+ * HttpHeaders headers = new HttpHeaders();
+ * headers.setApplicationName("Google-PicasaSample/1.0");
+ * headers.gdataVersion = "2";
+ * AtomParser parser = new AtomParser();
+ * parser.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
+ * transport.addParser(parser);
+ * // insert authentication code...
+ * return transport;
* }
- *
+ * }
*
* Now that we have a transport, we can execute a partial GET request to the Picasa Web Albums * API and parse the result: * - *
- * public static AlbumFeed executeGet(HttpTransport transport, PicasaUrl url)
- * throws IOException {
- * url.fields = GoogleAtom.getFieldsFor(AlbumFeed.class);
- * url.kinds = "photo";
- * url.maxResults = 5;
- * HttpRequest request = transport.buildGetRequest();
- * request.url = url;
- * return request.execute().parseAs(AlbumFeed.class);
+ * {@code
+ * public static AlbumFeed executeGet(HttpTransport transport, PicasaUrl url) throws IOException {
+ * url.fields = GoogleAtom.getFieldsFor(AlbumFeed.class);
+ * url.kinds = "photo";
+ * url.maxResults = 5;
+ * HttpRequest request = transport.buildGetRequest();
+ * request.url = url;
+ * return request.execute().parseAs(AlbumFeed.class);
* }
- *
+ * }
*
* If the server responds with an error the {@link * com.google.api.client.http.HttpRequest#execute} method will throw an {@link @@ -212,74 +211,72 @@ * com.google.api.client.http.HttpResponse} field which can be parsed the same way as a success * response inside of a catch block. For example: * - *
+ * {@code
* try {
- * ...
+ * ...
* } catch (HttpResponseException e) {
- * if (e.response.getParser() != null) {
- * Error error = e.response.parseAs(Error.class);
- * // process error response
- * } else {
- * String errorContentString = e.response.parseAsString();
- * // process error response as string
- * }
- * throw e;
+ * if (e.response.getParser() != null) {
+ * Error error = e.response.parseAs(Error.class);
+ * // process error response
+ * } else {
+ * String errorContentString = e.response.parseAsString();
+ * // process error response as string
+ * }
+ * throw e;
* }
- *
+ * }
*
* To update an album, we use the transport to execute an efficient partial update request using * the PATCH method to the Picasa Web Albums API: * - *
- * public AlbumEntry executePatchRelativeToOriginal(HttpTransport transport,
- * AlbumEntry original) throws IOException {
- * HttpRequest request = transport.buildPatchRequest();
- * request.setUrl(getEditLink());
- * request.headers.ifMatch = etag;
- * AtomPatchRelativeToOriginalContent content =
- * new AtomPatchRelativeToOriginalContent();
- * content.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
- * content.originalEntry = original;
- * content.patchedEntry = this;
- * request.content = content;
- * return request.execute().parseAs(AlbumEntry.class);
+ * {@code
+ * public AlbumEntry executePatchRelativeToOriginal
+ * (HttpTransport transport, AlbumEntry original) throws IOException {
+ * HttpRequest request = transport.buildPatchRequest();
+ * request.setUrl(getEditLink());
+ * request.headers.ifMatch = etag;
+ * AtomPatchRelativeToOriginalContent content = new AtomPatchRelativeToOriginalContent();
+ * content.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
+ * content.originalEntry = original;
+ * content.patchedEntry = this;
+ * request.content = content;
+ * return request.execute().parseAs(AlbumEntry.class);
* }
*
- * private static AlbumEntry updateTitle(HttpTransport transport,
- * AlbumEntry album) throws IOException {
- * AlbumEntry patched = album.clone();
- * patched.title = "An alternate title";
- * return patched.executePatchRelativeToOriginal(transport, album);
+ * private static AlbumEntry updateTitle
+ * (HttpTransport transport, AlbumEntry album) throws IOException {
+ * AlbumEntry patched = album.clone();
+ * patched.title = "An alternate title";
+ * return patched.executePatchRelativeToOriginal(transport, album);
* }
- *
+ * }
*
* To insert an album, we use the transport to execute a POST request to the Picasa Web Albums * API: * - *
- * public AlbumEntry insertAlbum(HttpTransport transport, AlbumEntry entry)
- * throws IOException {
- * HttpRequest request = transport.buildPostRequest();
- * request.setUrl(getPostLink());
- * AtomContent content = new AtomContent();
- * content.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
- * content.entry = entry;
- * request.content = content;
- * return request.execute().parseAs(AlbumEntry.class);
+ * {@code
+ * public AlbumEntry insertAlbum(HttpTransport transport, AlbumEntry entry) throws IOException {
+ * HttpRequest request = transport.buildPostRequest();
+ * request.setUrl(getPostLink());
+ * AtomContent content = new AtomContent();
+ * content.namespaceDictionary = PicasaWebAlbumsAtom.NAMESPACE_DICTIONARY;
+ * content.entry = entry;
+ * request.content = content;
+ * return request.execute().parseAs(AlbumEntry.class);
* }
- *
+ * }
*
* To delete an album, we use the transport to execute a DELETE request to the Picasa Web Albums * API: * - *
+ * {@code
* public void executeDelete(HttpTransport transport) throws IOException {
- * HttpRequest request = transport.buildDeleteRequest();
- * request.setUrl(getEditLink());
- * request.headers.ifMatch = etag;
- * request.execute().ignore();
+ * HttpRequest request = transport.buildDeleteRequest();
+ * request.setUrl(getEditLink());
+ * request.headers.ifMatch = etag;
+ * request.execute().ignore();
* }
- *
+ * }
*
* NOTE: As you might guess, the library uses reflection to populate the user-defined data model. * It's not quite as fast as writing the wire format parsing code yourself can potentially be, but diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/MethodOverride.java b/google-api-client/src/main/java/com/google/api/client/googleapis/MethodOverride.java index 6ffe157c7..ae80267aa 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/MethodOverride.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/MethodOverride.java @@ -37,11 +37,11 @@ * *
Sample usage, taking advantage that this class implements {@link HttpRequestInitializer}: * - *
+ ** *{@code * public static HttpRequestFactory createRequestFactory(HttpTransport transport) { - * return transport.createRequestFactory(new MethodOverride()); + * return transport.createRequestFactory(new MethodOverride()); * } - *+ * }
If you have a custom request initializer, take a look at the sample usage for {@link * HttpExecuteInterceptor}, which this class also implements. diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeRequestUrl.java b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeRequestUrl.java index 7e59e0af1..6049c2842 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeRequestUrl.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeRequestUrl.java @@ -34,16 +34,17 @@ * *
Sample usage for a web application: * - *
+ ** *{@code * public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - * String url = - * new GoogleAuthorizationCodeRequestUrl("812741506391.apps.googleusercontent.com", - * "https://oauth2-login-demo.appspot.com/code", Arrays.asList( - * "https://www.googleapis.com/auth/userinfo.email", - * "https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build(); - * response.sendRedirect(url); + * String url = new GoogleAuthorizationCodeRequestUrl( + * "812741506391.apps.googleusercontent.com", + * "https://oauth2-login-demo.appspot.com/code", + * Arrays.asList("https://www.googleapis.com/auth/userinfo.email", + * "https://www.googleapis.com/auth/userinfo.profile")) + * .setState("/profile").build(); + * response.sendRedirect(url); * } - *+ * }
Implementation is not thread-safe. * diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeTokenRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeTokenRequest.java index ff05084a9..bf40cb806 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeTokenRequest.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorizationCodeTokenRequest.java @@ -29,9 +29,9 @@ /** * Google-specific implementation of the OAuth 2.0 request for an access token based on an - * authorization code (as specified in Using OAuth 2.0 for Web - * Server Applications). + * authorization code (as specified in Using OAuth 2.0 for Web Server + * Applications). * *
Use {@link GoogleCredential} to access protected resources from the resource server using the * {@link TokenResponse} returned by {@link #execute()}. On error, it will instead throw {@link @@ -39,30 +39,30 @@ * *
Sample usage: * - *
+ ** *{@code * static void requestAccessToken() throws IOException { - * try { - * GoogleTokenResponse response = - * new GoogleAuthorizationCodeTokenRequest(new NetHttpTransport(), new GsonFactory(), - * "812741506391.apps.googleusercontent.com", "{client_secret}", - * "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7", "https://oauth2-login-demo.appspot.com/code") - * .execute(); - * System.out.println("Access token: " + response.getAccessToken()); - * } catch (TokenResponseException e) { - * if (e.getDetails() != null) { - * System.err.println("Error: " + e.getDetails().getError()); - * if (e.getDetails().getErrorDescription() != null) { - * System.err.println(e.getDetails().getErrorDescription()); + * try { + * GoogleTokenResponse response = new GoogleAuthorizationCodeTokenRequest( + * new NetHttpTransport(), new GsonFactory(), + * "812741506391.apps.googleusercontent.com", "{client_secret}", + * "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7", "https://oauth2-login-demo.appspot.com/code") + * .execute(); + * System.out.println("Access token: " + response.getAccessToken()); + * } catch (TokenResponseException e) { + * if (e.getDetails() != null) { + * System.err.println("Error: " + e.getDetails().getError()); + * if (e.getDetails().getErrorDescription() != null) { + * System.err.println(e.getDetails().getErrorDescription()); + * } + * if (e.getDetails().getErrorUri() != null) { + * System.err.println(e.getDetails().getErrorUri()); + * } + * } else { + * System.err.println(e.getMessage()); + * } + * } * } - * if (e.getDetails().getErrorUri() != null) { - * System.err.println(e.getDetails().getErrorUri()); - * } - * } else { - * System.err.println(e.getMessage()); - * } - * } - * } - *+ * }
Implementation is not thread-safe. * diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleBrowserClientRequestUrl.java b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleBrowserClientRequestUrl.java index 8ba70afce..1e266585e 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleBrowserClientRequestUrl.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleBrowserClientRequestUrl.java @@ -30,15 +30,15 @@ * *
Sample usage for a web application: * - *
+ ** *{@code * public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - * String url = new GoogleBrowserClientRequestUrl("812741506391.apps.googleusercontent.com", - * "https://oauth2-login-demo.appspot.com/oauthcallback", Arrays.asList( - * "https://www.googleapis.com/auth/userinfo.email", - * "https://www.googleapis.com/auth/userinfo.profile")).setState("/profile").build(); - * response.sendRedirect(url); + * String url = new GoogleBrowserClientRequestUrl("812741506391.apps.googleusercontent.com", + * "https://oauth2-login-demo.appspot.com/oauthcallback", Arrays.asList( + * "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile")) + * .setState("/profile").build(); + * response.sendRedirect(url); * } - *+ * }
Implementation is not thread-safe. * diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleClientSecrets.java b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleClientSecrets.java index cc82cc35f..c20780aa0 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleClientSecrets.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleClientSecrets.java @@ -29,7 +29,7 @@ * *
Sample usage: * - *
+ ** * @since 1.7 * @author Yaniv Inbar diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java index 45f10da08..632b495e6 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java @@ -69,11 +69,11 @@ * credential using {@link Builder#setFromTokenResponse(TokenResponse)}. Google credential uses * {@link BearerToken#authorizationHeaderAccessMethod()} as the access method. Sample usage: * - *{@code * static GoogleClientSecrets loadClientSecretsResource(JsonFactory jsonFactory) * throws IOException { * return GoogleClientSecrets.load( @@ -39,7 +39,7 @@ * ) * ); * } - *+ * }
+ ** *{@code * public static GoogleCredential createCredentialWithAccessTokenOnly(TokenResponse tokenResponse) { - * return new GoogleCredential().setFromTokenResponse(tokenResponse); + * return new GoogleCredential().setFromTokenResponse(tokenResponse); * } - *+ * }
If you have a refresh token, it is similar to the case of access token only, but you * additionally need to pass the credential the client secrets using {@link @@ -82,61 +82,55 @@ * server URL, and {@link ClientParametersAuthentication} with the client ID and secret as the * client authentication. Sample usage: * - *
- * public static GoogleCredential createCredentialWithRefreshToken(HttpTransport transport, - * JsonFactory jsonFactory, GoogleClientSecrets clientSecrets, TokenResponse tokenResponse) { - * return new GoogleCredential.Builder().setTransport(transport) - * .setJsonFactory(jsonFactory) - * .setClientSecrets(clientSecrets) - * .build() - * .setFromTokenResponse(tokenResponse); + ** - *{@code + * public static GoogleCredential createCredentialWithRefreshToken( + * HttpTransport transport, JsonFactory jsonFactory, + * GoogleClientSecrets clientSecrets, TokenResponse tokenResponse) { + * return new GoogleCredential.Builder().setTransport(transport) + * .setJsonFactory(jsonFactory) + * .setClientSecrets(clientSecrets) + * .build() + * .setFromTokenResponse(tokenResponse); * } - *+ * }
The service account - * flow is used when you want to access data owned by your client application. You download the - * private key in a {@code .p12} file from the Google APIs Console. Use {@link + *
The service + * account flow is used when you want to access data owned by your client application. You + * download the private key in a {@code .p12} file from the Google APIs Console. Use {@link * Builder#setServiceAccountId(String)}, {@link * Builder#setServiceAccountPrivateKeyFromP12File(File)}, and {@link * Builder#setServiceAccountScopes(Collection)}. Sample usage: * - *
- * public static GoogleCredential createCredentialForServiceAccount( - * HttpTransport transport, - * JsonFactory jsonFactory, - * String serviceAccountId, - * Collection<String> serviceAccountScopes, - * File p12File) throws GeneralSecurityException, IOException { - * return new GoogleCredential.Builder().setTransport(transport) - * .setJsonFactory(jsonFactory) - * .setServiceAccountId(serviceAccountId) - * .setServiceAccountScopes(serviceAccountScopes) - * .setServiceAccountPrivateKeyFromP12File(p12File) - * .build(); + ** *{@code + * public static GoogleCredential createCredentialForServiceAccount(HttpTransport transport, + * JsonFactory jsonFactory, + * String serviceAccountId, Collection<String> serviceAccountScopes, File p12File) + * throws GeneralSecurityException, IOException { + * return new GoogleCredential.Builder().setTransport(transport).setJsonFactory(jsonFactory) + * .setServiceAccountId(serviceAccountId).setServiceAccountScopes(serviceAccountScopes) + * .setServiceAccountPrivateKeyFromP12File(p12File).build(); * } - *+ * }
You can also use the service account flow to impersonate a user in a domain that you own. This * is very similar to the service account flow above, but you additionally call {@link * Builder#setServiceAccountUser(String)}. Sample usage: * - *
- * public static GoogleCredential createCredentialForServiceAccountImpersonateUser( - * HttpTransport transport, - * JsonFactory jsonFactory, - * String serviceAccountId, - * Collection<String> serviceAccountScopes, - * File p12File, - * String serviceAccountUser) throws GeneralSecurityException, IOException { - * return new GoogleCredential.Builder().setTransport(transport) - * .setJsonFactory(jsonFactory) - * .setServiceAccountId(serviceAccountId) - * .setServiceAccountScopes(serviceAccountScopes) - * .setServiceAccountPrivateKeyFromP12File(p12File) - * .setServiceAccountUser(serviceAccountUser) - * .build(); + ** *{@code + * public static GoogleCredential createCredentialForServiceAccountImpersonateUser + * (HttpTransport transport, JsonFactory jsonFactory, String serviceAccountId, + * Collection<String> serviceAccountScopes, File p12File, + * String serviceAccountUser) throws GeneralSecurityException, IOException { + * return new GoogleCredential.Builder() + * .setTransport(transport) + * .setJsonFactory(jsonFactory) + * .setServiceAccountId(serviceAccountId) + * .setServiceAccountScopes(serviceAccountScopes) + * .setServiceAccountPrivateKeyFromP12File(p12File) + * .setServiceAccountUser(serviceAccountUser) + * .build(); * } - *+ * }
If you need to persist the access token in a data store, use {@link DataStoreFactory} and * {@link Builder#addRefreshListener(CredentialRefreshListener)} with {@link diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleIdTokenVerifier.java b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleIdTokenVerifier.java index f10bdac3f..7592d075c 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleIdTokenVerifier.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleIdTokenVerifier.java @@ -39,13 +39,15 @@ * of the {@link GooglePublicKeysManager} since that way the Google public keys are cached. Sample * usage: * - *
+ ** * @since 1.7 */ diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleRefreshTokenRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleRefreshTokenRequest.java index 55ba20fc0..4bc245d73 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleRefreshTokenRequest.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleRefreshTokenRequest.java @@ -37,28 +37,29 @@ * *{@code * GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(transport, jsonFactory) - * .setAudience(Arrays.asList("myClientId")) - * .build(); + * .setAudience(Arrays.asList("myClientId")) + * .build(); + * * ... + * * if (!verifier.verify(googleIdToken)) {...} - *+ * }
Sample usage: * - *
+ ** *{@code * static void refreshAccessToken() throws IOException { - * try { - * TokenResponse response = - * new GoogleRefreshTokenRequest(new NetHttpTransport(), new GsonFactory(), - * "tGzv3JOkF0XG5Qx2TlKWIA", "s6BhdRkqt3", "7Fjfp0ZBr1KtDRbnfVdmIw").execute(); - * System.out.println("Access token: " + response.getAccessToken()); - * } catch (TokenResponseException e) { - * if (e.getDetails() != null) { - * System.err.println("Error: " + e.getDetails().getError()); - * if (e.getDetails().getErrorDescription() != null) { - * System.err.println(e.getDetails().getErrorDescription()); + * try { + * TokenResponse response = new GoogleRefreshTokenRequest( + * new NetHttpTransport(), new GsonFactory(), + * "tGzv3JOkF0XG5Qx2TlKWIA", "s6BhdRkqt3", + * "7Fjfp0ZBr1KtDRbnfVdmIw").execute(); + * System.out.println("Access token: " + response.getAccessToken()); + * } catch (TokenResponseException e) { + * if (e.getDetails() != null) { + * System.err.println("Error: " + e.getDetails().getError()); + * if (e.getDetails().getErrorDescription() != null) { + * System.err.println(e.getDetails().getErrorDescription()); + * } + * if (e.getDetails().getErrorUri() != null) { + * System.err.println(e.getDetails().getErrorUri()); + * } + * } else { + * System.err.println(e.getMessage()); + * } + * } * } - * if (e.getDetails().getErrorUri() != null) { - * System.err.println(e.getDetails().getErrorUri()); - * } - * } else { - * System.err.println(e.getMessage()); - * } - * } - * } - *+ * }
Implementation is not thread-safe. * diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchCallback.java b/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchCallback.java index f0fc05448..efad4717f 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchCallback.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/batch/BatchCallback.java @@ -22,20 +22,20 @@ * *
Sample use: * - *
+ ** * @param{@code * batch.queue(volumesList.buildHttpRequest(), Volumes.class, GoogleJsonErrorContainer.class, - * new BatchCallback<Volumes, GoogleJsonErrorContainer>() { - * - * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { - * log("Success"); - * printVolumes(volumes.getItems()); - * } - * - * public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { - * log(e.getError().getMessage()); - * } - * }); - *+ * new BatchCallback<Volumes, GoogleJsonErrorContainer>() { + * + * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { + * log("Success"); + * printVolumes(volumes.getItems()); + * } + * + * public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { + * log(e.getError().getMessage()); + * } + * }); + * }
Sample use: * - *
- * // client is a AbstractGoogleClient (e.g. com.google.api.services.books.Books) + ** *{@code + * // client is a AbstractGoogleClient (e.g. + * // com.google.api.services.books.Books) * BatchRequest batch = client.batch(httpRequestInitializer); * batch.queue(volumesList, Volumes.class, GoogleJsonErrorContainer.class, - * new BatchCallback<Volumes, GoogleJsonErrorContainer>() { + * new BatchCallback<Volumes, GoogleJsonErrorContainer>() { * - * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { - * log("Success"); - * printVolumes(volumes.getItems()); - * } + * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { + * log("Success"); + * printVolumes(volumes.getItems()); + * } * - * public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { - * log(e.getError().getMessage()); - * } - * }); + * public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { + * log(e.getError().getMessage()); + * } + * }); * batch.queue(volumesList, Volumes.class, GoogleJsonErrorContainer.class, - * new BatchCallback<Volumes, GoogleJsonErrorContainer>() { + * new BatchCallback<Volumes, GoogleJsonErrorContainer>() { * - * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { - * log("Success"); - * printVolumes(volumes.getItems()); - * } + * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { + * log("Success"); + * printVolumes(volumes.getItems()); + * } * - * public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { - * log(e.getError().getMessage()); - * } - * }); + * public void onFailure(GoogleJsonErrorContainer e, HttpHeaders responseHeaders) { + * log(e.getError().getMessage()); + * } + * }); * batch.execute(); - *+ * }
The content of each individual response is stored in memory. There is thus a potential of * encountering an {@link OutOfMemoryError} for very large responses. diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/batch/json/JsonBatchCallback.java b/google-api-client/src/main/java/com/google/api/client/googleapis/batch/json/JsonBatchCallback.java index 563f20cb7..53f252e89 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/batch/json/JsonBatchCallback.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/batch/json/JsonBatchCallback.java @@ -25,20 +25,19 @@ * *
Sample use: * - *
+ ** * @param{@code * batch.queue(volumesList.buildHttpRequest(), Volumes.class, GoogleJsonErrorContainer.class, - * new JsonBatchCallback<Volumes>() { - * - * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { - * log("Success"); - * printVolumes(volumes.getItems()); - * } - * - * public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) { - * log(e.getMessage()); - * } - * }); - *+ * new JsonBatchCallback<Volumes>() { + * public void onSuccess(Volumes volumes, HttpHeaders responseHeaders) { + * log("Success"); + * printVolumes(volumes.getItems()); + * } + * + * public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) { + * log(e.getMessage()); + * } + * }); + * }
Sample usage: * - *
+ ** *{@code * public static HttpRequestFactory createRequestFactory( - * HttpTransport transport, JsonFactory jsonFactory) { - * return transport.createRequestFactory(new GoogleComputeCredential(transport, jsonFactory)); + * HttpTransport transport, JsonFactory jsonFactory) { + * return transport.createRequestFactory( + * new GoogleComputeCredential(transport, jsonFactory)); * } - *+ * }
Implementation is immutable and thread-safe. * diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/javanet/GoogleNetHttpTransport.java b/google-api-client/src/main/java/com/google/api/client/googleapis/javanet/GoogleNetHttpTransport.java index e6099014e..66907fc72 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/javanet/GoogleNetHttpTransport.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/javanet/GoogleNetHttpTransport.java @@ -44,14 +44,14 @@ public class GoogleNetHttpTransport { * as the ability to specify a proxy. To do use, use {@link * com.google.api.client.http.javanet.NetHttpTransport.Builder}, for example: * - *
+ **/ public static NetHttpTransport newTrustedTransport() throws GeneralSecurityException, IOException { diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java b/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java index 246c3fd1e..c0f0eb86b 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/json/GoogleJsonError.java @@ -260,7 +260,7 @@ public void setParameter(String parameter) { /** Human-readable explanation of the error or {@code null} for none. */ @Key private String message; - /** Lists type and parameterViolation details of an Exception */ + /** Lists type and parameterViolation details of an Exception. */ @Key private List{@code * static HttpTransport newProxyTransport() throws GeneralSecurityException, IOException { * NetHttpTransport.Builder builder = new NetHttpTransport.Builder(); * builder.trustCertificates(GoogleUtils.getCertificateTrustStore()); * builder.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 3128))); * return builder.build(); * } - *+ * }
To execute a request, call {@link #execute(JsonFactory, HttpRequest)}. This will throw a * {@link GoogleJsonResponseException} on an error response. To get the structured details, use * {@link #getDetails()}. * - *
+ ** * @since 1.6 * @author Yaniv Inbar @@ -154,14 +154,14 @@ public static GoogleJsonResponseException from(JsonFactory jsonFactory, HttpResp * is no longer needed. However, {@link HttpResponse#disconnect} does not have to be called if the * response stream is properly closed. Example usage: * - *{@code * static void executeShowingError(JsonFactory factory, HttpRequest request) throws IOException { - * try { - * GoogleJsonResponseException.execute(factory, request); - * } catch (GoogleJsonResponseException e) { - * System.err.println(e.getDetails()); + * try { + * GoogleJsonResponseException.execute(factory, request); + * } catch (GoogleJsonResponseException e) { + * System.err.println(e.getDetails()); + * } * } - * } - *+ * }
+ ** * @param jsonFactory JSON factory * @param request HTTP request diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/json/package-info.java b/google-api-client/src/main/java/com/google/api/client/googleapis/json/package-info.java index d3c81065c..84fe5f78a 100644 --- a/google-api-client/src/main/java/com/google/api/client/googleapis/json/package-info.java +++ b/google-api-client/src/main/java/com/google/api/client/googleapis/json/package-info.java @@ -17,151 +17,162 @@ * *{@code * HttpResponse response = GoogleJsonResponseException.execute(jsonFactory, request); * try { - * // process the HTTP response object + * // process the HTTP response object * } finally { - * response.disconnect(); + * response.disconnect(); * } - *+ * }
User-defined Partial JSON data models allow you to defined Plain Old Java Objects (POJO's) to - * define how the library should parse/serialize JSON. Each field that should be included must have - * an @{@link com.google.api.client.util.Key} annotation. The field can be of any visibility - * (private, package private, protected, or public) and must not be static. By default, the field - * name is used as the JSON key. To override this behavior, simply specify the JSON key use the - * optional value parameter of the annotation, for example {@code @Key("name")}. Any unrecognized - * keys from the JSON are normally simply ignored and not stored. If the ability to store unknown - * keys is important, use {@link com.google.api.client.json.GenericJson}. - * - *
Let's take a look at a typical partial JSON-C video feed from the YouTube Data API (as
- * specified in YouTube
+ *
+ * User-defined Partial JSON data models allow you to defined Plain Old Java
+ * Objects (POJO's) to define how the library should parse/serialize JSON. Each
+ * field that should be included must have
+ * an @{@link com.google.api.client.util.Key} annotation. The field can be of
+ * any visibility (private, package private, protected, or public) and must not
+ * be static. By default, the field name is used as the JSON key. To override
+ * this behavior, simply specify the JSON key use the optional value parameter
+ * of the annotation, for example {@code @Key("name")}. Any unrecognized keys
+ * from the JSON are normally simply ignored and not stored. If the ability to
+ * store unknown keys is important, use
+ * {@link com.google.api.client.json.GenericJson}.
+ *
+ *
+ * Let's take a look at a typical partial JSON-C video feed from the YouTube
+ * Data API (as specified in YouTube
* Developer's Guide: JSON-C / JavaScript)
*
- * Here's one possible way to design the Java data classes for this (each class in its own Java
- * file):
- *
- *
+ * Here's one possible way to design the Java data classes for this (each class
+ * in its own Java file):
+ *
+ * You can also use the @{@link com.google.api.client.util.Key} annotation to defined query
- * parameters for a URL. For example:
+ *
+ * You can also use the @{@link com.google.api.client.util.Key} annotation to
+ * defined query parameters for a URL. For example:
*
- * To work with the YouTube API, you first need to set up the {@link
+ *
+ * To work with the YouTube API, you first need to set up the {@link
* com.google.api.client.http.HttpTransport}. For example:
*
- * Now that we have a transport, we can execute a request to the YouTube API and parse the
- * result:
+ *
+ * Now that we have a transport, we can execute a request to the YouTube API and
+ * parse the result:
*
- * If the server responds with an error the {@link
+ *
+ * If the server responds with an error the {@link
* com.google.api.client.http.HttpRequest#execute} method will throw an {@link
* com.google.api.client.http.HttpResponseException}, which has an {@link
- * com.google.api.client.http.HttpResponse} field which can be parsed the same way as a success
- * response inside of a catch block. For example:
+ * com.google.api.client.http.HttpResponse} field which can be parsed the same
+ * way as a success response inside of a catch block. For example:
*
- * NOTE: As you might guess, the library uses reflection to populate the user-defined data model.
- * It's not quite as fast as writing the wire format parsing code yourself can potentially be, but
- * it's a lot easier.
+ *
+ * NOTE: As you might guess, the library uses reflection to populate the
+ * user-defined data model. It's not quite as fast as writing the wire format
+ * parsing code yourself can potentially be, but it's a lot easier.
*
- * NOTE: If you prefer to use your favorite JSON parsing library instead (there are many of them
- * listed for example on json.org), that's supported as well. Just
- * call {@link com.google.api.client.http.HttpRequest#execute()} and parse the returned byte stream.
+ *
+ * NOTE: If you prefer to use your favorite JSON parsing library instead (there
+ * are many of them listed for example on
+ * json.org), that's supported as well. Just call
+ * {@link com.google.api.client.http.HttpRequest#execute()} and parse the
+ * returned byte stream.
*
* @since 1.0
+ *
* @author Yaniv Inbar
*/
package com.google.api.client.googleapis.json;
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpDownloaderProgressListener.java b/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpDownloaderProgressListener.java
index 639556024..199f4dfed 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpDownloaderProgressListener.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpDownloaderProgressListener.java
@@ -21,22 +21,22 @@
*
* Sample usage:
*
- * If an error is encountered during the request execution the caller is responsible for
* parsing the response correctly. For example for JSON errors:
*
- * Callers should call {@link HttpResponse#disconnect} when the returned HTTP response object
* is no longer needed. However, {@link HttpResponse#disconnect} does not have to be called if the
* response stream is properly closed. Example usage:
*
- * Sample usage (if media content length is provided, else consider using {@link
* MediaHttpUploader#getNumBytesUploaded} instead of {@link MediaHttpUploader#getProgress}:
*
- * Implementation should be thread-safe. Example usage:
*
- * Should be thread-safe as several notifications might be processed at the same time. Example
* usage:
*
- * Implementation should be thread-safe. Example usage:
*
- * Must be called before the Google client request is executed, preferably right after the
* request is instantiated. Sample usage:
*
- * Subclasses may override by calling the super implementation.
*
@@ -183,12 +183,12 @@ protected void initialize(AbstractGoogleClientRequest> httpClientRequest) thro
*
* Sample usage:
*
- * Sample usage:
*
- * Callers are responsible for disconnecting the HTTP response by calling {@link
* HttpResponse#disconnect}. Example usage:
*
- * Subclasses may override by calling the super implementation.
*
@@ -461,14 +461,14 @@ public HttpResponse executeUnparsed() throws IOException {
* Callers are responsible for disconnecting the HTTP response by calling {@link
* HttpResponse#disconnect}. Example usage:
*
- * Subclasses may override by calling the super implementation.
*
@@ -487,10 +487,10 @@ protected HttpResponse executeMedia() throws IOException {
* be empty and ignored. Calls {@link HttpResponse#ignore()} so there is no need to disconnect the
* response. Example usage:
*
- * Subclasses may override by calling the super implementation.
*
@@ -571,14 +571,14 @@ public T execute() throws IOException {
*
* Callers are responsible for closing the input stream after it is processed. Example sample:
*
- * Subclasses may override by calling the super implementation.
*
@@ -594,14 +594,14 @@ public InputStream executeAsInputStream() throws IOException {
*
* Callers are responsible for closing the input stream after it is processed. Example sample:
*
- * Subclasses may override by calling the super implementation.
*
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/services/CommonGoogleClientRequestInitializer.java b/google-api-client/src/main/java/com/google/api/client/googleapis/services/CommonGoogleClientRequestInitializer.java
index 7491a10f7..f26572c42 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/services/CommonGoogleClientRequestInitializer.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/services/CommonGoogleClientRequestInitializer.java
@@ -20,53 +20,53 @@
*
* The simplest usage is to use it to set the key parameter:
*
- * There is also a constructor to set both the key and userIp parameters:
*
- * If you want to implement custom logic, extend it like this:
*
- * Finally, to set the key and userIp parameters and insert custom logic, extend it like this:
*
- * Subclasses should be thread-safe.
*
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/services/GoogleClientRequestInitializer.java b/google-api-client/src/main/java/com/google/api/client/googleapis/services/GoogleClientRequestInitializer.java
index f8bcf90db..8644a4c39 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/services/GoogleClientRequestInitializer.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/services/GoogleClientRequestInitializer.java
@@ -19,13 +19,13 @@
*
* For example, this might be used to set a key URL query parameter on all requests:
*
- * Implementations should be thread-safe.
*
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/AbstractGoogleJsonClientRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/AbstractGoogleJsonClientRequest.java
index a1f2d3694..f0fb5a98d 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/AbstractGoogleJsonClientRequest.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/AbstractGoogleJsonClientRequest.java
@@ -92,18 +92,18 @@ public AbstractGoogleJsonClientRequest Example usage:
*
- * The simplest usage is to use it to set the key parameter:
*
- * There is also a constructor to set both the key and userIp parameters:
*
- * If you want to implement custom logic, extend it like this:
*
- * Finally, to set the key and userIp parameters and insert custom logic, extend it like this:
*
- * Subclasses should be thread-safe.
*
- *
- *
+ *
{@code
* "data":{
- * "updated":"2010-01-07T19:58:42.949Z",
- * "totalItems":800,
- * "startIndex":1,
- * "itemsPerPage":1,
- * "items":[
- * {"id":"hYB0mn5zh2c",
- * "updated":"2010-01-07T13:26:50.000Z",
- * "title":"Google Developers Day US - Maps API Introduction",
- * "description":"Google Maps API Introduction ...",
- * "tags":[
- * "GDD07","GDD07US","Maps"
- * ],
- * "player":{
- * "default":"http://www.youtube.com/watch?v\u003dhYB0mn5zh2c"
- * },
- * ...
- * }
- * ]
- * }
- *
+ *
+ *
+ * "updated":"2010-01-07T19:58:42.949Z",
+ * "totalItems":800,
+ * "startIndex":1,
+ * "itemsPerPage":1,
+ * "items":[
+ * {"id":"hYB0mn5zh2c",
+ * "updated":"2010-01-07T13:26:50.000Z",
+ * "title":"Google Developers Day US - Maps API Introduction",
+ * "description":"Google Maps API Introduction ...",
+ * "tags":[
+ * "GDD07","GDD07US","Maps"],
+ * "player":{
+ * "default":"http://www.youtube.com/watch?v\u003dhYB0mn5zh2c" },
+ * ...
+ * }]}
+ * }
{@code
* import com.google.api.client.util.*;
* import java.util.List;
*
* public class VideoFeed {
- * @Key public int itemsPerPage;
- * @Key public int startIndex;
- * @Key public int totalItems;
- * @Key public DateTime updated;
- * @Key public List<Video> items;
+ * @Key public int itemsPerPage;
+ * @Key public int startIndex;
+ * @Key public int totalItems;
+ * @Key public DateTime updated;
+ * @Key public List<Video> items;
* }
*
* public class Video {
- * @Key public String id;
- * @Key public String title;
- * @Key public DateTime updated;
- * @Key public String description;
- * @Key public List<String> tags;
- * @Key public Player player;
+ * @Key public String id;
+ * @Key public String title;
+ * @Key public DateTime updated;
+ * @Key public String description;
+ * @Key public List<String> tags;
+ * @Key public Player player;
* }
*
* public class Player {
- * // "default" is a Java keyword, so need to specify the JSON key manually
- * @Key("default")
- * public String defaultUrl;
+ * // "default" is a Java keyword, so need to specify the JSON key manually
+ * @Key("default")
+ * public String defaultUrl;
* }
- *
+ * }
*
- *
+ * public YouTubeUrl(String encodedUrl) {
+ * super(encodedUrl);
+ * this.alt = "jsonc";
+ * }
+ * }
*
- *
+ *
{@code
* public class YouTubeUrl extends GoogleUrl {
*
- * @Key
- * public String author;
+ * @Key
+ * public String author;
*
- * @Key("max-results")
- * public Integer maxResults;
+ * @Key("max-results")
+ * public Integer maxResults;
*
- * public YouTubeUrl(String encodedUrl) {
- * super(encodedUrl);
- * this.alt = "jsonc";
- * }
- *
+ * }
*
- *
+ *
{@code
* private static HttpTransport setUpTransport() throws IOException {
- * HttpTransport result = new NetHttpTransport();
- * GoogleUtils.useMethodOverride(result);
- * HttpHeaders headers = new HttpHeaders();
- * headers.setApplicationName("Google-YouTubeSample/1.0");
- * headers.gdataVersion = "2";
- * JsonCParser parser = new JsonCParser();
- * parser.jsonFactory = new GsonFactory();
- * transport.addParser(parser);
- * // insert authentication code...
- * return transport;
+ * HttpTransport result = new NetHttpTransport();
+ * GoogleUtils.useMethodOverride(result);
+ * HttpHeaders headers = new HttpHeaders();
+ * headers.setApplicationName("Google-YouTubeSample/1.0");
+ * headers.gdataVersion = "2";
+ * JsonCParser parser = new JsonCParser();
+ * parser.jsonFactory = new GsonFactory();
+ * transport.addParser(parser);
+ * // insert authentication code...
+ * return transport;
* }
- *
+ * }
*
- *
- * public static VideoFeed list(HttpTransport transport, YouTubeUrl url)
- * throws IOException {
- * HttpRequest request = transport.buildGetRequest();
- * request.url = url;
- * return request.execute().parseAs(VideoFeed.class);
+ *
{@code
+ * public static VideoFeed list(HttpTransport transport, YouTubeUrl url) throws IOException {
+ * HttpRequest request = transport.buildGetRequest();
+ * request.url = url;
+ * return request.execute().parseAs(VideoFeed.class);
* }
- *
+ * }
*
- *
+ *
{@code
* try {
- * ...
+ * ...
* } catch (HttpResponseException e) {
- * if (e.response.getParser() != null) {
- * Error error = e.response.parseAs(Error.class);
- * // process error response
- * } else {
- * String errorContentString = e.response.parseAsString();
- * // process error response as string
- * }
- * throw e;
+ * if (e.response.getParser() != null) {
+ * Error error = e.response.parseAs(Error.class);
+ * // process error response
+ * } else {
+ * String errorContentString = e.response.parseAsString();
+ * // process error response as string
+ * }
+ * throw e;
* }
- *
+ *
*
* @since 1.9
* @author rmistry@google.com (Ravi Mistry)
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploader.java b/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploader.java
index 0d85e8e9f..6ea87a96f 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploader.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploader.java
@@ -277,24 +277,24 @@ public MediaHttpUploader(
* {@code
* public static class MyDownloadProgressListener implements MediaHttpDownloaderProgressListener {
*
- * public void progressChanged(MediaHttpDownloader downloader) throws IOException {
- * switch (downloader.getDownloadState()) {
- * case MEDIA_IN_PROGRESS:
- * System.out.println("Download in progress");
- * System.out.println("Download percentage: " + downloader.getProgress());
- * break;
- * case MEDIA_COMPLETE:
- * System.out.println("Download Completed!");
- * break;
+ * public void progressChanged(MediaHttpDownloader downloader) throws IOException {
+ * switch (downloader.getDownloadState()) {
+ * case MEDIA_IN_PROGRESS:
+ * System.out.println("Download in progress");
+ * System.out.println("Download percentage: " + downloader.getProgress());
+ * break;
+ * case MEDIA_COMPLETE:
+ * System.out.println("Download Completed!");
+ * break;
+ * }
+ * }
* }
- * }
- * }
- *
+ * }
+ *
*
* {@code
* if (!response.isSuccessStatusCode()) {
- * throw GoogleJsonResponseException.from(jsonFactory, response);
+ * throw GoogleJsonResponseException.from(jsonFactory, response);
* }
- *
+ * }
+ *
*
* @param initiationRequestUrl The request URL where the initiation request will be sent
* @return HTTP response
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploaderProgressListener.java b/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploaderProgressListener.java
index f85708626..6a5c755f0 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploaderProgressListener.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploaderProgressListener.java
@@ -22,28 +22,28 @@
* {@code
* HttpResponse response = batch.upload(initiationRequestUrl);
* try {
- * // process the HTTP response object
+ * // process the HTTP response object
* } finally {
- * response.disconnect();
+ * response.disconnect();
* }
- *
+ * }
+ *
*
* @since 1.9
* @author rmistry@google.com (Ravi Mistry)
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/mtls/ContextAwareMetadataJson.java b/google-api-client/src/main/java/com/google/api/client/googleapis/mtls/ContextAwareMetadataJson.java
index d900594ac..3612be97a 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/mtls/ContextAwareMetadataJson.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/mtls/ContextAwareMetadataJson.java
@@ -27,7 +27,7 @@
*/
@Beta
public class ContextAwareMetadataJson extends GenericJson {
- /** Cert provider command */
+ /** Cert provider command. */
@Key("cert_provider_command")
private List{@code
* public static class MyUploadProgressListener implements MediaHttpUploaderProgressListener {
*
- * public void progressChanged(MediaHttpUploader uploader) throws IOException {
- * switch (uploader.getUploadState()) {
- * case INITIATION_STARTED:
- * System.out.println("Initiation Started");
- * break;
- * case INITIATION_COMPLETE:
- * System.out.println("Initiation Completed");
- * break;
- * case MEDIA_IN_PROGRESS:
- * System.out.println("Upload in progress");
- * System.out.println("Upload percentage: " + uploader.getProgress());
- * break;
- * case MEDIA_COMPLETE:
- * System.out.println("Upload Completed!");
- * break;
+ * public void progressChanged(MediaHttpUploader uploader) throws IOException {
+ * switch (uploader.getUploadState()) {
+ * case INITIATION_STARTED:
+ * System.out.println("Initiation Started");
+ * break;
+ * case INITIATION_COMPLETE:
+ * System.out.println("Initiation Completed");
+ * break;
+ * case MEDIA_IN_PROGRESS:
+ * System.out.println("Upload in progress");
+ * System.out.println("Upload percentage: " + uploader.getProgress());
+ * break;
+ * case MEDIA_COMPLETE:
+ * System.out.println("Upload Completed!");
+ * break;
+ * }
+ * }
* }
- * }
- * }
- *
+ * }
+ *
*
* @param {@code
* static class MyNotificationCallback
- * extends JsonNotificationCallback{@literal <}ListResponse{@literal >} {
+ * extends JsonNotificationCallback{@literal <}ListResponse{@literal >} {
*
- * private static final long serialVersionUID = 1L;
+ * private static final long serialVersionUID = 1L;
*
- * {@literal @}Override
- * protected void onNotification(
- * StoredChannel subscription, Notification notification, ListResponse content) {
- * switch (notification.getResourceState()) {
- * case ResourceStates.SYNC:
- * break;
- * case ResourceStates.EXISTS:
- * break;
- * case ResourceStates.NOT_EXISTS:
- * break;
- * }
- * }
+ * {@literal @}Override
+ * protected void onNotification
+ * (StoredChannel subscription, Notification notification, ListResponse content) {
+ * switch (notification.getResourceState()) {
+ * case ResourceStates.SYNC:
+ * break;
+ * case ResourceStates.EXISTS:
+ * break;
+ * case ResourceStates.NOT_EXISTS:
+ * break;
+ * }
+ * }
*
- * {@literal @}Override
- * protected ObjectParser getObjectParser(Notification notification) throws IOException {
- * return new JsonObjectParser(new GsonFactory());
- * }
+ * {@literal @}Override
+ * protected ObjectParser getObjectParser(Notification notification) throws IOException {
+ * return new JsonObjectParser(new GsonFactory());
+ * }
*
- * {@literal @}Override
- * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
- * return ListResponse.class;
- * }
+ * {@literal @}Override
+ * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
+ * return ListResponse.class;
+ * }
* }
- *
+ * }
+ *
*
* @author Yaniv Inbar
* @author Matthias Linder (mlinder)
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/json/JsonNotificationCallback.java b/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/json/JsonNotificationCallback.java
index 70658bce7..bc0421017 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/json/JsonNotificationCallback.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/notifications/json/JsonNotificationCallback.java
@@ -28,37 +28,37 @@
*
* {@code
* static class MyNotificationCallback implements UnparsedNotificationCallback {
*
- * private static final long serialVersionUID = 1L;
+ * private static final long serialVersionUID = 1L;
*
- * {@literal @}Override
- * public void onNotification(StoredChannel storedChannel, UnparsedNotification notification) {
- * String contentType = notification.getContentType();
- * InputStream contentStream = notification.getContentStream();
- * switch (notification.getResourceState()) {
- * case ResourceStates.SYNC:
- * break;
- * case ResourceStates.EXISTS:
- * break;
- * case ResourceStates.NOT_EXISTS:
- * break;
+ * {@literal @}Override
+ * public void onNotification(StoredChannel storedChannel, UnparsedNotification notification) {
+ * String contentType = notification.getContentType();
+ * InputStream contentStream = notification.getContentStream();
+ * switch (notification.getResourceState()) {
+ * case ResourceStates.SYNC:
+ * break;
+ * case ResourceStates.EXISTS:
+ * break;
+ * case ResourceStates.NOT_EXISTS:
+ * break;
+ * }
+ * }
* }
- * }
- * }
- *
+ * }
+ *
*
* @param {@code
* static class MyNotificationCallback
- * extends JsonNotificationCallback{@literal <}ListResponse{@literal >} {
+ * extends JsonNotificationCallback{@literal <}ListResponse{@literal >} {
*
- * private static final long serialVersionUID = 1L;
+ * private static final long serialVersionUID = 1L;
*
- * {@literal @}Override
- * protected void onNotification(
- * StoredChannel channel, TypedNotification{@literal <}ListResponse{@literal >} notification) {
- * ListResponse content = notification.getContent();
- * switch (notification.getResourceState()) {
- * case ResourceStates.SYNC:
- * break;
- * case ResourceStates.EXISTS:
- * break;
- * case ResourceStates.NOT_EXISTS:
- * break;
- * }
- * }
+ * {@literal @}Override
+ * protected void onNotification(StoredChannel channel,
+ * TypedNotification{@literal <}ListResponse{@literal >} notification) {
+ * ListResponse content = notification.getContent();
+ * switch (notification.getResourceState()) {
+ * case ResourceStates.SYNC:
+ * break;
+ * case ResourceStates.EXISTS:
+ * break;
+ * case ResourceStates.NOT_EXISTS:
+ * break;
+ * }
+ * }
*
- * {@literal @}Override
- * protected JsonFactory getJsonFactory() throws IOException {
- * return new GsonFactory();
- * }
+ * {@literal @}Override
+ * protected JsonFactory getJsonFactory() throws IOException {
+ * return new GsonFactory();
+ * }
*
- * {@literal @}Override
- * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
- * return ListResponse.class;
- * }
+ * {@literal @}Override
+ * protected Class{@literal <}ListResponse{@literal >} getDataClass() throws IOException {
+ * return ListResponse.class;
+ * }
* }
- *
+ * }
+ *
*
* {@code
* public class Get extends HttpClientRequest {
- * ...
+ * ...
* }
*
* public Get get(String userId) throws IOException {
- * Get result = new Get(userId);
- * initialize(result);
- * return result;
+ * Get result = new Get(userId);
+ * initialize(result);
+ * return result;
* }
- *
+ * }
+ *
*
* @return newly created Batch request
*/
@@ -201,12 +201,12 @@ public final BatchRequest batch() {
*
* {@code
* client.batch()
- * .queue(...)
- * .queue(...)
- * .execute();
- *
+ * .queue(...)
+ * .queue(...)
+ * .execute();
+ * }
+ *
*
* @param httpRequestInitializer The initializer to use when creating the top-level batch HTTP
* request or {@code null} for none
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java b/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
index d16a71c5b..72ab6e937 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/services/AbstractGoogleClientRequest.java
@@ -438,14 +438,14 @@ public void interceptResponse(HttpResponse response) throws IOException {
* {@code
* client.batch(httpRequestInitializer)
- * .queue(...)
- * .queue(...)
- * .execute();
- *
+ * .queue(...)
+ * .queue(...)
+ * .execute();
+ * }
+ *
*
* {@code
* HttpResponse response = request.executeUnparsed();
* try {
- * // process response..
+ * // process response..
* } finally {
- * response.disconnect();
+ * response.disconnect();
* }
- *
+ * }
+ *
*
* {@code
* HttpResponse response = request.executeMedia();
* try {
- * // process response..
+ * // process response..
* } finally {
- * response.disconnect();
+ * response.disconnect();
* }
- *
+ * }
+ *
*
* {@code
* HttpResponse response = request.executeUsingHead();
* // look at response.getHeaders()
- *
+ * }
+ *
*
* {@code
* InputStream is = request.executeAsInputStream();
* try {
- * // Process input stream..
+ * // Process input stream..
* } finally {
- * is.close();
+ * is.close();
* }
- *
+ * }
+ *
*
* {@code
* InputStream is = request.executeMediaAsInputStream();
* try {
- * // Process input stream..
+ * // Process input stream..
* } finally {
- * is.close();
+ * is.close();
* }
- *
+ * }
+ *
*
* {@code
* public static final GoogleClientRequestInitializer KEY_INITIALIZER =
- * CommonGoogleClientRequestInitializer.newBuilder()
- * .setKey(KEY)
- * .build();
- *
+ * CommonGoogleClientRequestInitializer.newBuilder()
+ * .setKey(KEY)
+ * .build();
+ * }
+ *
*
* {@code
* public static final GoogleClientRequestInitializer INITIALIZER =
* CommonGoogleClientRequestInitializer.newBuilder()
* .setKey(KEY)
* .setUserIp(USER_IP)
* .build();
- *
+ * }
+ *
*
* {@code
* public static class MyRequestInitializer extends CommonGoogleClientRequestInitializer {
*
- * {@literal @}Override
- * public void initialize(AbstractGoogleClientRequest{@literal <}?{@literal >} request)
- * throws IOException {
- * // custom logic
+ * {@literal @}Override
+ * public void initialize
+ * (AbstractGoogleClientRequest{@literal <}?{@literal >} request) throws IOException {
+ * // custom logic
+ * }
* }
- * }
- *
+ * }
+ *
*
* {@code
* public static class MyRequestInitializer2 extends CommonGoogleClientRequestInitializer {
*
- * public MyRequestInitializer2() {
- * super(KEY, USER_IP);
- * }
+ * public MyRequestInitializer2() {
+ * super(KEY, USER_IP);
+ * }
*
- * {@literal @}Override
- * public void initialize(AbstractGoogleClientRequest{@literal <}?{@literal >} request)
- * throws IOException {
- * super.initialize(request); // must be called to set the key and userIp parameters
- * // insert some additional logic
- * }
+ * {@literal @}Override
+ * public void initialize
+ * (AbstractGoogleClientRequest{@literal <}?{@literal >} request) throws IOException {
+ * super.initialize(request); // must be called to set the key and userIp parameters
+ * // insert some additional logic
+ * }
* }
- *
+ * }
+ *
*
* {@code
* public class KeyRequestInitializer implements GoogleClientRequestInitializer {
- * public void initialize(GoogleClientRequest> request) {
- * request.put("key", KEY);
+ * public void initialize(GoogleClientRequest> request) {
+ * request.put("key", KEY);
+ * }
* }
- * }
- *
+ * }
+ *
*
* @param batchRequest batch request container
* @param callback batch callback
diff --git a/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/CommonGoogleJsonClientRequestInitializer.java b/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/CommonGoogleJsonClientRequestInitializer.java
index 020aba147..c52924b49 100644
--- a/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/CommonGoogleJsonClientRequestInitializer.java
+++ b/google-api-client/src/main/java/com/google/api/client/googleapis/services/json/CommonGoogleJsonClientRequestInitializer.java
@@ -23,52 +23,52 @@
*
* {@code
* request.queue(batchRequest, new JsonBatchCallback<SomeResponseType>() {
*
- * public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) {
- * log("Success");
- * }
+ * public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) {
+ * log("Success");
+ * }
*
- * public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
- * log(e.getMessage());
- * }
+ * public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
+ * log(e.getMessage());
+ * }
* });
- *
+ * }
+ *
*
* {@code
* public static final GoogleClientRequestInitializer KEY_INITIALIZER =
- * CommonGoogleJsonClientRequestInitializer.newBuilder()
- * .setKey(KEY)
- * .build();
- *
+ * CommonGoogleJsonClientRequestInitializer.newBuilder()
+ * .setKey(KEY)
+ * .build();
+ * }
+ *
*
* {@code
* public static final GoogleClientRequestInitializer INITIALIZER =
- * CommonGoogleJsonClientRequestInitializer.newBuilder()
- * .setKey(KEY)
- * .setUserIp(USER_IP)
- * .build();
- *
+ * CommonGoogleJsonClientRequestInitializer.newBuilder()
+ * .setKey(KEY)
+ * .setUserIp(USER_IP)
+ * .build();
+ * }
+ *
*
* {@code
* public static class MyRequestInitializer extends CommonGoogleJsonClientRequestInitializer {
*
- * {@literal @}Override
- * public void initialize(AbstractGoogleJsonClientRequest{@literal <}?{@literal >} request)
- * throws IOException {
- * // custom logic
+ * {@literal @}Override
+ * public void initialize(AbstractGoogleJsonClientRequest{@literal <}?{@literal >} request)
+ * throws IOException {
+ * // custom logic
+ * }
* }
- * }
- *
+ * }
+ *
*
* {@code
* public static class MyKeyRequestInitializer extends CommonGoogleJsonClientRequestInitializer {
*
- * public MyKeyRequestInitializer() {
- * super(KEY, USER_IP);
- * }
+ * public MyKeyRequestInitializer() {
+ * super(KEY, USER_IP);
+ * }
*
- * {@literal @}Override
- * public void initializeJsonRequest(
- * AbstractGoogleJsonClientRequest{@literal <}?{@literal >} request) throws IOException {
- * // custom logic
- * }
+ * {@literal @}Override
+ * public void initializeJsonRequest
+ * (AbstractGoogleJsonClientRequest{@literal <}?{@literal >} request) throws IOException {
+ * // custom logic
+ * }
* }
- *
+ * }