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

io.sphere.sdk.types.TypeDraftBuilder Maven / Gradle / Ivy

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

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.List;
import java.util.Set;

public class TypeDraftBuilder extends Base implements Builder {

    private String key;
    private LocalizedString name;
    @Nullable
    private LocalizedString description;
    private Set resourceTypeIds;

    @Nullable
    private List fieldDefinitions;

    private TypeDraftBuilder(final String key, final LocalizedString name, final LocalizedString description, final Set resourceTypeIds, final List fieldDefinitions) {
        this.key = key;
        this.name = name;
        this.description = description;
        this.resourceTypeIds = resourceTypeIds;
        this.fieldDefinitions = fieldDefinitions;
    }

    public static TypeDraftBuilder of(final String key, final LocalizedString name, final Set resourceTypeIds) {
        return new TypeDraftBuilder(key, name, null, resourceTypeIds, null);
    }

    public TypeDraftBuilder description(final LocalizedString description) {
        this.description = description;
        return this;
    }

    public TypeDraftBuilder fieldDefinitions(final List fieldDefinitions) {
        this.fieldDefinitions = fieldDefinitions;
        return this;
    }

    @Override
    public TypeDraft build() {
        return new TypeDraftImpl(key, name, description, resourceTypeIds, fieldDefinitions);
    }

    public String getKey() {
        return key;
    }

    public LocalizedString getName() {
        return name;
    }

    @Nullable
    public LocalizedString getDescription() {
        return description;
    }

    public Set getResourceTypeIds() {
        return resourceTypeIds;
    }

    @Nullable
    public List getFieldDefinitions() {
        return fieldDefinitions;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy