io.sphere.sdk.states.State Maven / Gradle / Ivy
package io.sphere.sdk.states;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.models.DefaultModel;
import io.sphere.sdk.models.LocalizedStrings;
import io.sphere.sdk.models.Reference;
import java.util.Optional;
import java.util.Set;
/** A State represents a state of a particular entity (defines a finite state machine). States can be combined together
by defining transitions between each state, thus allowing to create work-flows.
Each project has by default an initial LineItemState (inherited also by custom Line Items)
Operations:
- Create a state with {@link io.sphere.sdk.states.commands.StateCreateCommand}.
- Fetch a state by key with {@link io.sphere.sdk.states.queries.StateByKeyFetch}.
- Query a state with {@link io.sphere.sdk.states.queries.StateQuery}.
- Delete a channel with {@link io.sphere.sdk.states.commands.StateDeleteCommand}.
*/
@JsonDeserialize(as = StateImpl.class)
public interface State extends DefaultModel {
public String getKey();
public StateType getType();
public Optional getName();
public Optional getDescription();
public boolean isInitial();
public boolean isBuiltIn();
public Optional>> getTransitions();
public default Reference toReference() {
return Reference.of(typeId(), getId());
}
public static String typeId(){
return "state";
}
public static TypeReference typeReference(){
return new TypeReference() {
@Override
public String toString() {
return "TypeReference";
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy