io.sphere.sdk.states.StateDraftDslBase Maven / Gradle / Ivy
package io.sphere.sdk.states;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Reference;
import java.lang.Boolean;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Set;
import javax.annotation.Generated;
import javax.annotation.Nullable;
/**
* Abstract base dsl class for {@link StateDraft} which needs to be extended to add additional methods.
* Subclasses have to provide the same non-default constructor as this class.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator",
comments = "Generated from: io.sphere.sdk.states.StateDraft"
)
abstract class StateDraftDslBase extends Base implements StateDraft {
@Nullable
private LocalizedString description;
@Nullable
private Boolean initial;
private String key;
@Nullable
private LocalizedString name;
@Nullable
private Set roles;
@Nullable
private Set> transitions;
private StateType type;
@JsonCreator
StateDraftDslBase(@Nullable final LocalizedString description,
@Nullable @JsonProperty("initial") final Boolean initial, final String key,
@Nullable final LocalizedString name, @Nullable final Set roles,
@Nullable final Set> transitions, final StateType type) {
this.description = description;
this.initial = initial;
this.key = key;
this.name = name;
this.roles = roles;
this.transitions = transitions;
this.type = type;
}
@Nullable
public LocalizedString getDescription() {
return description;
}
@Nullable
@JsonProperty("initial")
public Boolean isInitial() {
return initial;
}
public String getKey() {
return key;
}
@Nullable
public LocalizedString getName() {
return name;
}
@Nullable
public Set getRoles() {
return roles;
}
@Nullable
public Set> getTransitions() {
return transitions;
}
public StateType getType() {
return type;
}
/**
* Creates a new builder with the values of this object.
*
* @return new builder
*/
public StateDraftBuilder newBuilder() {
return new StateDraftBuilder(description, initial, key, name, roles, transitions, type);
}
@SuppressWarnings("unchecked")
public T withDescription(@Nullable final LocalizedString description) {
return (T) newBuilder().description(description).build();
}
@SuppressWarnings("unchecked")
public T withInitial(@Nullable final Boolean initial) {
return (T) newBuilder().initial(initial).build();
}
@SuppressWarnings("unchecked")
public T withKey(final String key) {
return (T) newBuilder().key(key).build();
}
@SuppressWarnings("unchecked")
public T withName(@Nullable final LocalizedString name) {
return (T) newBuilder().name(name).build();
}
@SuppressWarnings("unchecked")
public T withRoles(@Nullable final Set roles) {
return (T) newBuilder().roles(roles).build();
}
@SuppressWarnings("unchecked")
public T withTransitions(@Nullable final Set> transitions) {
return (T) newBuilder().transitions(transitions).build();
}
@SuppressWarnings("unchecked")
public T withType(final StateType type) {
return (T) newBuilder().type(type).build();
}
/**
* Creates a new object initialized with the given values.
*
* @param key initial value for the {@link StateDraft#getKey()} property
* @param type initial value for the {@link StateDraft#getType()} property
* @return new object initialized with the given values
*/
public static StateDraftDsl of(final String key, final StateType type) {
return new StateDraftDsl(null, null, key, null, null, null, type);
}
/**
* Creates a new object initialized with the fields of the template parameter.
*
* @param template the template
* @return a new object initialized from the template
*/
public static StateDraftDsl of(final StateDraft template) {
return new StateDraftDsl(template.getDescription(), template.isInitial(), template.getKey(), template.getName(), template.getRoles(), template.getTransitions(), template.getType());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy