Skip to content

Commit 84029d7

Browse files
---
yaml --- r: 8123 b: refs/heads/tswast-patch-1 c: 603b4ae h: refs/heads/master i: 8121: 3566b49 8119: 5621146
1 parent 4f6e192 commit 84029d7

2 files changed

Lines changed: 49 additions & 6 deletions

File tree

  • branches/tswast-patch-1/google-cloud-resourcemanager/src/main/java/com/google/cloud/resourcemanager

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: 40984bef3f1bd8591df5324159ec65bb71ecfbfc
60+
refs/heads/tswast-patch-1: 603b4ae6f55a064ed04081cc919930f9a01010e2
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/google-cloud-resourcemanager/src/main/java/com/google/cloud/resourcemanager/ProjectInfo.java

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
import static com.google.common.base.MoreObjects.firstNonNull;
2020
import static com.google.common.base.Preconditions.checkNotNull;
2121

22+
import com.google.api.core.ApiFunction;
2223
import com.google.api.client.util.Data;
24+
import com.google.cloud.StringEnumType;
25+
import com.google.cloud.StringEnumValue;
2326
import com.google.common.collect.ImmutableMap;
2427
import com.google.common.collect.Maps;
2528

@@ -50,27 +53,67 @@ public class ProjectInfo implements Serializable {
5053
/**
5154
* The project lifecycle states.
5255
*/
53-
public enum State {
56+
public static final class State extends StringEnumValue {
57+
private static final long serialVersionUID = 869635563976629566L;
58+
59+
private static final ApiFunction<String, State> CONSTRUCTOR =
60+
new ApiFunction<String, State>() {
61+
@Override
62+
public State apply(String constant) {
63+
return new State(constant);
64+
}
65+
};
66+
67+
private static final StringEnumType<State> type = new StringEnumType(
68+
State.class,
69+
CONSTRUCTOR);
70+
5471
/**
5572
* Only used/useful for distinguishing unset values.
5673
*/
57-
LIFECYCLE_STATE_UNSPECIFIED,
74+
public static final State LIFECYCLE_STATE_UNSPECIFIED = type.createAndRegister("LIFECYCLE_STATE_UNSPECIFIED");
5875

5976
/**
6077
* The normal and active state.
6178
*/
62-
ACTIVE,
79+
public static final State ACTIVE = type.createAndRegister("ACTIVE");
6380

6481
/**
6582
* The project has been marked for deletion by the user or by the system (Google Cloud
6683
* Platform). This can generally be reversed by calling {@link ResourceManager#undelete}.
6784
*/
68-
DELETE_REQUESTED,
85+
public static final State DELETE_REQUESTED = type.createAndRegister("DELETE_REQUESTED");
6986

7087
/**
7188
* The process of deleting the project has begun. Reversing the deletion is no longer possible.
7289
*/
73-
DELETE_IN_PROGRESS
90+
public static final State DELETE_IN_PROGRESS = type.createAndRegister("DELETE_IN_PROGRESS");
91+
92+
private State(String constant) {
93+
super(constant);
94+
}
95+
96+
/**
97+
* Get the State for the given String constant, and throw an exception if the constant is
98+
* not recognized.
99+
*/
100+
public static State valueOfStrict(String constant) {
101+
return type.valueOfStrict(constant);
102+
}
103+
104+
/**
105+
* Get the State for the given String constant, and allow unrecognized values.
106+
*/
107+
public static State valueOf(String constant) {
108+
return type.valueOf(constant);
109+
}
110+
111+
/**
112+
* Return the known values for State.
113+
*/
114+
public static State[] values() {
115+
return type.values();
116+
}
74117
}
75118

76119
static class ResourceId implements Serializable {

0 commit comments

Comments
 (0)