From 1b2da14aabfb474a800e80503ba716a43093ee69 Mon Sep 17 00:00:00 2001 From: danikov Date: Fri, 2 Mar 2012 12:45:18 +0000 Subject: [PATCH] add incremental builder method --- .../director/v1_5/domain/FilesList.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java index 050ecd1d86..642a6131ff 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java @@ -20,13 +20,14 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; import java.util.Set; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import com.google.common.base.Objects; -import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -66,23 +67,29 @@ public class FilesList { public static class Builder { - private Set files = Sets.newLinkedHashSet(); + private List files = Lists.newLinkedList(); + + /** + * @see FilesList#getFiles() + */ + public Builder files(List files) { + this.files = Lists.newLinkedList(checkNotNull(files, "files")); + return this; + } /** * @see FilesList#getFiles() */ - public Builder files(Set files) { - this.files = files; + public Builder file(File file) { + files.add(checkNotNull(file, "file")); return this; } - - + public FilesList build() { FilesList filesList = new FilesList(files); return filesList; } - public Builder fromFilesList(FilesList in) { return files(in.getFiles()); }