Add Javadoc to clarify behavior of {Accounts|Changes|Groups}#withOptions

On these classes there are two withOptions methods with different
arguments. It is reasonable to expect that both methods behave the
same, and there are two of them only for convenience.

However this is not the case; the methods behave differently. The one
taking a varargs array of options appends the options to the existing
options, while the one taking a EnumSet replaces the existing options.

Add Javadoc on the methods to explicitly document the differences in
behavior.

Change-Id: I148c1595506ae43c35419eee99b1be7e265099b1
This commit is contained in:
David Pursehouse 2019-01-17 11:30:00 +09:00
parent 038473962e
commit 28f241aeb5
3 changed files with 9 additions and 0 deletions

View File

@ -166,16 +166,19 @@ public interface Accounts {
return this;
}
/** Set an option on the request, appending to existing options. */
public QueryRequest withOption(ListAccountsOption options) {
this.options.add(options);
return this;
}
/** Set options on the request, appending to existing options. */
public QueryRequest withOptions(ListAccountsOption... options) {
this.options.addAll(Arrays.asList(options));
return this;
}
/** Set options on the request, replacing existing options. */
public QueryRequest withOptions(EnumSet<ListAccountsOption> options) {
this.options = options;
return this;

View File

@ -94,16 +94,19 @@ public interface Changes {
return this;
}
/** Set an option on the request, appending to existing options. */
public QueryRequest withOption(ListChangesOption options) {
this.options.add(options);
return this;
}
/** Set options on the request, appending to existing options. */
public QueryRequest withOptions(ListChangesOption... options) {
this.options.addAll(Arrays.asList(options));
return this;
}
/** Set options on the request, replacing existing options. */
public QueryRequest withOptions(EnumSet<ListChangesOption> options) {
this.options = options;
return this;

View File

@ -243,16 +243,19 @@ public interface Groups {
return this;
}
/** Set an option on the request, appending to existing options. */
public QueryRequest withOption(ListGroupsOption options) {
this.options.add(options);
return this;
}
/** Set options on the request, appending to existing options. */
public QueryRequest withOptions(ListGroupsOption... options) {
this.options.addAll(Arrays.asList(options));
return this;
}
/** Set options on the request, replacing existing options. */
public QueryRequest withOptions(EnumSet<ListGroupsOption> options) {
this.options = options;
return this;