Skip to content

Commit b999bff

Browse files
authored
Run google-java-format on all artifacts (googleapis#4121)
* Run google-java-format on all artifats * Format some missed files * Add more missed files * Fix formatting issues from the merge
1 parent b91553a commit b999bff

23 files changed

Lines changed: 571 additions & 523 deletions

java-resourcemanager/google-cloud-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Option.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020

2121
import com.google.cloud.resourcemanager.spi.v1beta1.ResourceManagerRpc;
2222
import com.google.common.base.MoreObjects;
23-
2423
import java.io.Serializable;
2524
import java.util.Objects;
2625

27-
/**
28-
* Base class for Resource Manager operation options.
29-
*/
26+
/** Base class for Resource Manager operation options. */
3027
abstract class Option implements Serializable {
3128

3229
private static final long serialVersionUID = 2655177550880762967L;
@@ -53,8 +50,7 @@ public boolean equals(Object obj) {
5350
return false;
5451
}
5552
Option other = (Option) obj;
56-
return Objects.equals(rpcOption, other.rpcOption)
57-
&& Objects.equals(value, other.value);
53+
return Objects.equals(rpcOption, other.rpcOption) && Objects.equals(value, other.value);
5854
}
5955

6056
@Override

java-resourcemanager/google-cloud-resourcemanager/src/main/java/com/google/cloud/resourcemanager/PolicyMarshaller.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.google.common.base.Function;
2525
import com.google.common.collect.ImmutableSet;
2626
import com.google.common.collect.Lists;
27-
2827
import java.util.ArrayList;
2928
import java.util.HashMap;
3029
import java.util.LinkedList;
@@ -55,13 +54,17 @@ protected Policy fromPb(com.google.api.services.cloudresourcemanager.model.Polic
5554
Map<Role, Set<Identity>> bindings = new HashMap<>();
5655
if (policyPb.getBindings() != null) {
5756
for (Binding bindingPb : policyPb.getBindings()) {
58-
bindings.put(Role.of(bindingPb.getRole()), ImmutableSet.copyOf(
59-
Lists.transform(bindingPb.getMembers(), new Function<String, Identity>() {
60-
@Override
61-
public Identity apply(String s) {
62-
return IDENTITY_VALUE_OF_FUNCTION.apply(s);
63-
}
64-
})));
57+
bindings.put(
58+
Role.of(bindingPb.getRole()),
59+
ImmutableSet.copyOf(
60+
Lists.transform(
61+
bindingPb.getMembers(),
62+
new Function<String, Identity>() {
63+
@Override
64+
public Identity apply(String s) {
65+
return IDENTITY_VALUE_OF_FUNCTION.apply(s);
66+
}
67+
})));
6568
}
6669
}
6770
return new Builder(bindings, policyPb.getEtag(), policyPb.getVersion()).build();
@@ -71,18 +74,19 @@ public Identity apply(String s) {
7174
protected com.google.api.services.cloudresourcemanager.model.Policy toPb(Policy policy) {
7275
com.google.api.services.cloudresourcemanager.model.Policy policyPb =
7376
new com.google.api.services.cloudresourcemanager.model.Policy();
74-
List<Binding> bindingPbList =
75-
new LinkedList<>();
77+
List<Binding> bindingPbList = new LinkedList<>();
7678
for (Map.Entry<Role, Set<Identity>> binding : policy.getBindings().entrySet()) {
7779
Binding bindingPb = new Binding();
7880
bindingPb.setRole(binding.getKey().getValue());
7981
bindingPb.setMembers(
80-
Lists.transform(new ArrayList<>(binding.getValue()), new Function<Identity, String>() {
81-
@Override
82-
public String apply(Identity identity) {
83-
return IDENTITY_STR_VALUE_FUNCTION.apply(identity);
84-
}
85-
}));
82+
Lists.transform(
83+
new ArrayList<>(binding.getValue()),
84+
new Function<Identity, String>() {
85+
@Override
86+
public String apply(Identity identity) {
87+
return IDENTITY_STR_VALUE_FUNCTION.apply(identity);
88+
}
89+
}));
8690
bindingPbList.add(bindingPb);
8791
}
8892
policyPb.setBindings(bindingPbList);

java-resourcemanager/google-cloud-resourcemanager/src/main/java/com/google/cloud/resourcemanager/Project.java

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

2121
import com.google.cloud.Policy;
22-
2322
import java.io.IOException;
2423
import java.io.ObjectInputStream;
2524
import java.util.List;
@@ -41,9 +40,7 @@ public class Project extends ProjectInfo {
4140
private final ResourceManagerOptions options;
4241
private transient ResourceManager resourceManager;
4342

44-
/**
45-
* Builder for {@code Project}.
46-
*/
43+
/** Builder for {@code Project}. */
4744
public static class Builder extends ProjectInfo.Builder {
4845
private final ResourceManager resourceManager;
4946
private final ProjectInfo.BuilderImpl infoBuilder;
@@ -53,14 +50,12 @@ public static class Builder extends ProjectInfo.Builder {
5350
this.infoBuilder = new ProjectInfo.BuilderImpl(project);
5451
}
5552

56-
5753
@Override
5854
public Builder setName(String name) {
5955
infoBuilder.setName(name);
6056
return this;
6157
}
6258

63-
6459
@Override
6560
public Builder setProjectId(String projectId) {
6661
infoBuilder.setProjectId(projectId);
@@ -85,7 +80,6 @@ public Builder clearLabels() {
8580
return this;
8681
}
8782

88-
8983
@Override
9084
public Builder setLabels(Map<String, String> labels) {
9185
infoBuilder.setLabels(labels);
@@ -128,17 +122,13 @@ public Project build() {
128122
this.options = resourceManager.getOptions();
129123
}
130124

131-
132-
/**
133-
* Returns the {@link ResourceManager} service object associated with this Project.
134-
*/
125+
/** Returns the {@link ResourceManager} service object associated with this Project. */
135126
public ResourceManager getResourceManager() {
136127
return resourceManager;
137128
}
138129

139130
/**
140-
* Fetches the project's latest information. Returns {@code null} if the project does not
141-
* exist.
131+
* Fetches the project's latest information. Returns {@code null} if the project does not exist.
142132
*
143133
* @return Project containing the project's updated metadata or {@code null} if not found
144134
* @throws ResourceManagerException upon failure
@@ -151,18 +141,20 @@ public Project reload() {
151141
* Marks the project identified by the specified project ID for deletion.
152142
*
153143
* <p>This method will only affect the project if the following criteria are met:
144+
*
154145
* <ul>
155-
* <li>The project does not have a billing account associated with it.
156-
* <li>The project has a lifecycle state of {@link ProjectInfo.State#ACTIVE}.
146+
* <li>The project does not have a billing account associated with it.
147+
* <li>The project has a lifecycle state of {@link ProjectInfo.State#ACTIVE}.
157148
* </ul>
149+
*
158150
* This method changes the project's lifecycle state from {@link ProjectInfo.State#ACTIVE} to
159151
* {@link ProjectInfo.State#DELETE_REQUESTED}. The deletion starts at an unspecified time, at
160152
* which point the lifecycle state changes to {@link ProjectInfo.State#DELETE_IN_PROGRESS}. Until
161153
* the deletion completes, you can check the lifecycle state checked by retrieving the project
162-
* with {@link ResourceManager#get}, and the project remains visible to
163-
* {@link ResourceManager#list}. However, you cannot update the project. After the deletion
164-
* completes, the project is not retrievable by the {@link ResourceManager#get} and
165-
* {@link ResourceManager#list} methods. The caller must have modify permissions for this project.
154+
* with {@link ResourceManager#get}, and the project remains visible to {@link
155+
* ResourceManager#list}. However, you cannot update the project. After the deletion completes,
156+
* the project is not retrievable by the {@link ResourceManager#get} and {@link
157+
* ResourceManager#list} methods. The caller must have modify permissions for this project.
166158
*
167159
* @throws ResourceManagerException upon failure
168160
* @see <a href=
@@ -176,10 +168,10 @@ public void delete() {
176168
/**
177169
* Restores the project identified by the specified project ID.
178170
*
179-
* <p>You can only use this method for a project that has a lifecycle state of
180-
* {@link ProjectInfo.State#DELETE_REQUESTED}. After deletion starts, as indicated by a lifecycle
181-
* state of {@link ProjectInfo.State#DELETE_IN_PROGRESS}, the project cannot be restored. The
182-
* caller must have modify permissions for this project.
171+
* <p>You can only use this method for a project that has a lifecycle state of {@link
172+
* ProjectInfo.State#DELETE_REQUESTED}. After deletion starts, as indicated by a lifecycle state
173+
* of {@link ProjectInfo.State#DELETE_IN_PROGRESS}, the project cannot be restored. The caller
174+
* must have modify permissions for this project.
183175
*
184176
* @throws ResourceManagerException upon failure (including when the project can't be restored)
185177
* @see <a href=
@@ -239,7 +231,7 @@ public Policy replacePolicy(Policy newPolicy) {
239231
* if you're using Google Cloud Platform directly to manage permissions. This method is intended
240232
* for integration with your proprietary software, such as a customized graphical user interface.
241233
* For example, the Cloud Platform Console tests IAM permissions internally to determine which UI
242-
* should be available to the logged-in user. Each service that supports IAM lists the possible
234+
* should be available to the logged-in user. Each service that supports IAM lists the possible
243235
* permissions; see the <i>Supported Cloud Platform services</i> page below for links to these
244236
* lists.
245237
*
@@ -249,9 +241,8 @@ public Policy replacePolicy(Policy newPolicy) {
249241
* @see <a href=
250242
* "https://cloud.google.com/resource-manager/reference/rest/v1beta1/projects/testIamPermissions">
251243
* Resource Manager testIamPermissions</a>
252-
* @see <a href=
253-
* "https://cloud.google.com/iam/#supported_cloud_platform_services">Supported Cloud Platform
254-
* Services</a>
244+
* @see <a href= "https://cloud.google.com/iam/#supported_cloud_platform_services">Supported Cloud
245+
* Platform Services</a>
255246
*/
256247
List<Boolean> testPermissions(List<String> permissions) {
257248
return resourceManager.testPermissions(getProjectId(), permissions);
@@ -271,8 +262,7 @@ public final boolean equals(Object obj) {
271262
return false;
272263
}
273264
Project other = (Project) obj;
274-
return Objects.equals(toPb(), other.toPb())
275-
&& Objects.equals(options, other.options);
265+
return Objects.equals(toPb(), other.toPb()) && Objects.equals(options, other.options);
276266
}
277267

278268
@Override
@@ -285,7 +275,8 @@ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundE
285275
this.resourceManager = options.getService();
286276
}
287277

288-
static Project fromPb(ResourceManager resourceManager,
278+
static Project fromPb(
279+
ResourceManager resourceManager,
289280
com.google.api.services.cloudresourcemanager.model.Project answer) {
290281
ProjectInfo info = ProjectInfo.fromPb(answer);
291282
return new Project(resourceManager, new ProjectInfo.BuilderImpl(info));

0 commit comments

Comments
 (0)