> +   public abstract String password();
> +   
> +   public abstract RoleInfo role();
> +   
> +   CreateAccount() {
> +   }
> +
> +   @SerializedNames({ "username", "password", "role"})
> +   public static CreateAccount create(String username, String password, 
> RoleInfo role) {
> +      checkArgument(username.length() > 0, "username must not be empty 
> string");
> +      checkArgument(password.length() > 0, "password must not be empty 
> string");
> +      if (role == null) role = RoleInfo.create("user", null);
> +      return new AutoValue_CreateAccount(username, password, role);
> +   }
> +   
> +   @SerializedNames({ "username", "password", "role"})

Oh, you're right. It might fail 
[here](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/json/internal/NamingStrategies.java#L177-193).

jclouds uses that annotation to get the serialized names for the fields, and 
matches the declared fields in the class with the annotation values, expecting 
all fields to have the corresponding value. As having the extra "role" 
parameter in the annotation looks confusing, can you try just removing the 
annotation from this method, and leave it only in the factory method that 
accepts all the parameters? This would be more close to the approach we follow 
with the constructors, where we only annotate the constructor that has all 
values.

I haven't tried it with the factory method approach, but looking at the code I 
think it should work.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/165/files#r29838864

Reply via email to