io.sphere.sdk.zones.ZoneDraft Maven / Gradle / Ivy
package io.sphere.sdk.zones;
import com.neovisionaries.i18n.CountryCode;
import javax.annotation.Nullable;
import java.util.Set;
import static java.util.stream.Collectors.toSet;
public class ZoneDraft {
private final String name;
@Nullable
private final String description;
private final Set locations;
private ZoneDraft(final String name, final Set locations, @Nullable final String description) {
this.description = description;
this.name = name;
this.locations = locations;
}
@Nullable
public String getDescription() {
return description;
}
public Set getLocations() {
return locations;
}
public String getName() {
return name;
}
public static ZoneDraft of(final String name, final Set locations) {
return of(name, locations, null);
}
public static ZoneDraft ofCountries(final String name, final Set countries, @Nullable final String description) {
final Set locations = countries.stream().map(country -> Location.of(country)).collect(toSet());
return new ZoneDraft(name, locations, description);
}
public static ZoneDraft of(final String name, final Set locations, @Nullable final String description) {
return new ZoneDraft(name, locations, description);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy