add incremental builder method

This commit is contained in:
danikov 2012-03-02 12:45:18 +00:00
parent 6a4ccc5178
commit 1b2da14aab
1 changed files with 14 additions and 7 deletions

View File

@ -20,13 +20,14 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -66,23 +67,29 @@ public class FilesList {
public static class Builder { public static class Builder {
private Set<File> files = Sets.newLinkedHashSet(); private List<File> files = Lists.newLinkedList();
/** /**
* @see FilesList#getFiles() * @see FilesList#getFiles()
*/ */
public Builder files(Set<File> files) { public Builder files(List<File> files) {
this.files = files; this.files = Lists.newLinkedList(checkNotNull(files, "files"));
return this; return this;
} }
/**
* @see FilesList#getFiles()
*/
public Builder file(File file) {
files.add(checkNotNull(file, "file"));
return this;
}
public FilesList build() { public FilesList build() {
FilesList filesList = new FilesList(files); FilesList filesList = new FilesList(files);
return filesList; return filesList;
} }
public Builder fromFilesList(FilesList in) { public Builder fromFilesList(FilesList in) {
return files(in.getFiles()); return files(in.getFiles());
} }