no.difi.sdp.client2.domain.Dokumentpakke Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sikker-digital-post-klient-java Show documentation
Show all versions of sikker-digital-post-klient-java Show documentation
Klient for sending av sikker digital post fra offentlige virksomheter.
package no.difi.sdp.client2.domain;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static java.util.Arrays.asList;
public class Dokumentpakke {
private Dokument hoveddokument;
private List vedlegg = Collections.emptyList();
private Dokumentpakke(Dokument hoveddokument) {
this.hoveddokument = hoveddokument;
}
public Dokument getHoveddokument() {
return hoveddokument;
}
public List getVedlegg() {
return vedlegg;
}
public static Builder builder(Dokument hoveddokument) {
return new Builder(hoveddokument);
}
public static class Builder {
private final Dokumentpakke target;
private boolean built = false;
private Builder(Dokument hoveddokument) {
target = new Dokumentpakke(hoveddokument);
}
public Builder vedlegg(List vedlegg) {
target.vedlegg = new ArrayList(vedlegg);
return this;
}
public Builder vedlegg(Dokument... vedlegg) {
return this.vedlegg(asList(vedlegg));
}
public Dokumentpakke build() {
if (built) throw new IllegalStateException("Can't build twice");
built = true;
return target;
}
}
}