io.sphere.sdk.states.StateDraftBuilder Maven / Gradle / Ivy
/*
This class has been generated by class io.sphere.sdk.annotations.processors.ResourceDraftValueAnnotationProcessor
induced by the annotation io.sphere.sdk.annotations.ResourceDraftValue.
in the source class io.sphere.sdk.states.StateDraft.
*/
package io.sphere.sdk.states;
import javax.annotation.Nullable;
import io.sphere.sdk.models.*;
import java.util.*;
import io.sphere.sdk.utils.*;
import com.fasterxml.jackson.annotation.*;
import io.sphere.sdk.models.Builder;
import com.fasterxml.jackson.annotation.JsonCreator;
/** Builder for {@link StateDraft}. */
public final class StateDraftBuilder extends io.sphere.sdk.models.Base implements Builder {
private java.lang.String key;
private io.sphere.sdk.states.StateType type;
@Nullable()
private io.sphere.sdk.models.LocalizedString name;
@Nullable()
private io.sphere.sdk.models.LocalizedString description;
@Nullable() @JsonProperty("initial")
private java.lang.Boolean initial;
@Nullable()
private java.util.Set> transitions;
@Nullable()
private java.util.Set roles;
@JsonCreator()
StateDraftBuilder(final io.sphere.sdk.models.LocalizedString description, @com.fasterxml.jackson.annotation.JsonProperty("initial") final java.lang.Boolean initial, final java.lang.String key, final io.sphere.sdk.models.LocalizedString name, final java.util.Set roles, final java.util.Set> transitions, final io.sphere.sdk.states.StateType type) {
this.description = description;
this.initial = initial;
this.key = key;
this.name = name;
this.roles = roles;
this.transitions = transitions;
this.type = type;
}
public StateDraftBuilder key(final java.lang.String key) {
this.key = key;
return this;
}
public StateDraftBuilder type(final io.sphere.sdk.states.StateType type) {
this.type = type;
return this;
}
public StateDraftBuilder name(@Nullable() final io.sphere.sdk.models.LocalizedString name) {
this.name = name;
return this;
}
public StateDraftBuilder description(@Nullable() final io.sphere.sdk.models.LocalizedString description) {
this.description = description;
return this;
}
public StateDraftBuilder initial(@Nullable() final java.lang.Boolean initial) {
this.initial = initial;
return this;
}
public StateDraftBuilder isInitial(@Nullable() final java.lang.Boolean initial) {
this.initial = initial;
return this;
}
public StateDraftBuilder transitions(@Nullable() final java.util.Set> transitions) {
this.transitions = transitions;
return this;
}
public StateDraftBuilder roles(@Nullable() final java.util.Set roles) {
this.roles = roles;
return this;
}
public StateDraftDsl build() {
return new StateDraftDsl(description, initial, key, name, roles, transitions, type);
}
public static StateDraftBuilder of(final java.lang.String key, final io.sphere.sdk.states.StateType type) {
return new StateDraftBuilder(null, null, key, null, null, null, type);
}
public static StateDraftBuilder of(final StateDraft template) {
return new StateDraftBuilder(template.getDescription(), template.isInitial(), template.getKey(), template.getName(), template.getRoles(), template.getTransitions(), template.getType());
}
public StateDraftBuilder roles(final StateRole role) {
return roles(Collections.singleton(role));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy