All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.channels.ChannelDraftBuilder Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.channels;

import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Builder;
import io.sphere.sdk.models.LocalizedString;

import javax.annotation.Nullable;
import java.util.Collections;
import java.util.Set;

public class ChannelDraftBuilder extends Base implements Builder {
    private final String key;
    private Set roles = Collections.emptySet();
    @Nullable
    private LocalizedString name;
    @Nullable
    private LocalizedString description;

    private ChannelDraftBuilder(final String key) {
        this.key = key;
    }

    public static ChannelDraftBuilder of(final String key) {
        return new ChannelDraftBuilder(key);
    }

    public static ChannelDraftBuilder of(final ChannelDraft template) {
        return new ChannelDraftBuilder(template.getKey())
                .roles(template.getRoles())
                .name(template.getName())
                .description(template.getDescription());
    }

    public ChannelDraftBuilder description(@Nullable final LocalizedString description) {
        this.description = description;
        return this;
    }
    
    public ChannelDraftBuilder name(@Nullable final LocalizedString name) {
        this.name = name;
        return this;
    }

    public ChannelDraftBuilder roles(final Set roles) {
        this.roles = roles;
        return this;
    }

    @Override
    public ChannelDraft build() {
        return new ChannelDraft(key, roles, name, description);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy