> +
> +    @Nullable
> +    public abstract String serverId();
> +
> +    @Nullable
> +    public abstract ImageFrequency frequency();
> +
> +    public abstract int numImages();
> +
> +    @Nullable
> +
> +    public abstract String creationDate();
> +
> +    @SerializedNames({"id", "name", "os_family", "os", "os_version", 
> "availableSites", "architecture", "os_image_type", "type", "min_hdd_size", 
> "licenses", "state", "description", "hdds", "server_id", "frequency", 
> "numImages", "creation_date"})
> +    public static Image create(String id, String name, OSFamliyType 
> osFamily, OSType os, String osVersion, List<String> availableSites, int 
> architecture, String osImageType, ImageType type, int minHddSize, 
> List<Licenses> licenses, String state, String description, List<Hdd> hdds, 
> String serverId, ImageFrequency frequency, int numImages, String 
> creationDate) {
> +        return new AutoValue_Image(id, name, osFamily, os, osVersion, 
> availableSites, architecture, osImageType, type, minHddSize, licenses, state, 
> description, hdds, serverId, frequency, numImages, creationDate);

In general it is a best practice to avoid having null collections, and helps a 
lot avoiding NPEs.

There is no problem in returning empty ones by default if the api does not 
return a value for them. But when sending requests, some apis require the 
values to be skipped from the json instead of sending an empty array. If empty 
arrays are ok in this api, then we'd better avoid having null collections and 
always initialize them to empty in the factory methods when the value is null.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/275/files/0767d011a984011133c9e34b3389b449ca0756cd#r68702235

Reply via email to