mirror of https://github.com/apache/jclouds.git
add incremental builder method
This commit is contained in:
parent
6a4ccc5178
commit
1b2da14aab
|
@ -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()
|
||||||
|
*/
|
||||||
|
public Builder files(List<File> files) {
|
||||||
|
this.files = Lists.newLinkedList(checkNotNull(files, "files"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see FilesList#getFiles()
|
* @see FilesList#getFiles()
|
||||||
*/
|
*/
|
||||||
public Builder files(Set<File> files) {
|
public Builder file(File file) {
|
||||||
this.files = files;
|
files.add(checkNotNull(file, "file"));
|
||||||
return this;
|
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());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue