fer626 / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Override setFields #483

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?

http://javadoc.google-api-java-client.googlecode.com/hg/apis/plus/v1/com/google/
api/services/plus/Plus.Activities.List.html

http://javadoc.google-api-java-client.googlecode.com/hg/apis/plus/v1/com/google/
api/services/plus/PlusRequest.html#setFields(java.lang.String)

http://code.google.com/p/google-api-java-client/source/browse/plus-cmdline-sampl
e/src/main/java/com/google/api/services/samples/plus/cmdline/PlusSample.java?rep
o=samples

Java environments (e.g. Java 6, Android 2.3, App Engine, or All)?

All

Please describe the feature requested.

Take a look at this snippet of sample code from plus-cmdline-sample:

    Plus.Activities.List listActivities = plus.activities().list("me", "public");
    // Pro tip: Use partial responses to improve response time considerably
listActivities.setFields("nextPageToken,items(id,url,object/content)");
    ActivityFeed feed = listActivities.execute();

Now, you may wonder why the setFields is on its own line.  That's because 
setFields is declared in PlusRequest, not Plus.Activities.List, so it returns a 
type of PlusRequest.  Therefore, you cannot call execute() on it.

Instead, I'd expect Plus.Activities.List to override setFields and return the 
type Plus.Activities.List (itself).  Then, I'd be able to do:

    Plus.Activities.List listActivities = plus.activities().list("me", "public")
        .setFields("nextPageToken,items(id,url,object/content)")
        .execute();

Original issue reported on code.google.com by yan...@google.com on 8 May 2012 at 4:00

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 16 May 2012 at 1:24

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 5 Jun 2012 at 12:18