jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <notificati...@github.com>
Subject Re: [jclouds-labs] JClouds Profitbricks provider - LoadBalancer API (#143)
Date Mon, 09 Mar 2015 16:58:36 GMT
> +import java.util.List;
> +
> +@AutoValue
> +public abstract class LoadBalancer {
> +
> +   public enum LoadbalancerAlgorithm {
> +
> +      ROUND_ROBIN, UNRECOGNIZED;
> +
> +      public static LoadbalancerAlgorithm
> +              fromValue(String value) {
> +         try {
> +            return valueOf(value);
> +         } catch (IllegalArgumentException e) {
> +            return UNRECOGNIZED;
> +         }

[nit] There is also a cleaner approach using Guava:
```java
return Enums.getIfPresent(LoadbalancerAlgorithm.class, value).or(UNRECOGNIZED);
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/143/files#r26053629
Mime
View raw message