Reputation: 2525
@ApiMethod(name = "foo")
public void foo(@Nullable @Named("bar") String bar, User auth) throws OAuthRequestException
ends up generating an API where the foo
method takes NO bar parameter. If I do not annotate with @Nullable, and just pass null from the client, I get an exception at runtime.
I'm sure this must be supported and I'm just doing something stupid. Thanks.
Upvotes: 2
Views: 979
Reputation: 647
was delayed understood without an example, here I write to compliment response of @Creos
collectionResponse = myApiService.activityByDay(idWebSafeFamily, token.getToken(), token.getTokenIdWebSafe(), nextPageToken).setIdUser(idUser).execute();
Upvotes: 1
Reputation: 2525
After a lot of googling, found the answer here @Nullable @Named in GAE / Android Sample
Basically, endpoints will generate a setXXX method which will accept your optional parameter. You ARE allowed to pass null to it so no need for if/else check where you only invoke the set API if your param is not null. Nifty.
Upvotes: 4