> +import java.util.Map;
> +
> +import com.google.common.collect.ImmutableMap;
> +
> +public enum JobStatus {
> + SUCCEEDED("Succeeded"),
> + FAILED("Failed"),
> + IN_PROGRESS("InProgress");
> +
> + private final String value;
> +
> + private static final Map<String, JobStatus> stringToEnum =
> ImmutableMap.of("Succeeded", SUCCEEDED,
> + "Failed", FAILED, "InProgress", IN_PROGRESS);
> +
> + public static JobStatus fromString(String symbol) {
> + return stringToEnum.get(symbol);
Sorry I see what you are doing here. Instead you can build up the `Map` via:
```
private static final Map<String, JobStatus> STRING_TO_ENUM;
static {
ImmutableMap.Builder<String, JobStatus> builder = ImmutableMap.builder();
for (JobStatus status : values()) {
builder.add(CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL,
status.toString(), status);
}
STRING_TO_ENUM = builder.build();
}
```
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/38/files#r14964298