Class StateId
java.lang.Object
com.yworkflow.definition.model.value.StateId
- All Implemented Interfaces:
DestinationId,ModelId,Comparable<StateId>
Represents a unique identifier for a workflow state. StateId is an immutable value object that
identifies a specific state within a workflow definition.
StateId implements both DestinationId and Comparable interfaces, making it suitable for use as a destination in workflow transitions and for ordering in collections. It supports both a value (required) and an optional name for human-readable identification.
States are the fundamental building blocks of workflows, representing different stages or conditions in a business process. Each state can have multiple transitions leading to other states, forks, or joins.
- Since:
- 1.0
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintCompares this StateId with another for ordering.booleanCompares this StateId with another object for equality.getName()Returns the optional human-readable name of this state.getValue()Returns the string value of this state ID.inthashCode()Returns the hash code for this StateId based on its string value.booleanReturns true since this is a StateId.Creates a new StateId with the same value but a different name.static StateIdCreates a StateId from the given value and name, returning null if the value is null.static StateIdCreates a new StateId with the specified value and no name.static StateIdCreates a new StateId with the specified value and name.toString()Returns a string representation of this StateId.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.yworkflow.definition.model.value.DestinationId
isForkId, isJoinId
-
Field Details
-
EMPTY
Represents an empty state ID, used when no specific state is specified. -
SELF
Represents a self-reference state ID, used to indicate that a transition should remain in the current state.
-
-
Method Details
-
getValue
Returns the string value of this state ID.- Specified by:
getValuein interfaceDestinationId- Specified by:
getValuein interfaceModelId- Returns:
- the state identifier string
-
getName
Returns the optional human-readable name of this state.- Specified by:
getNamein interfaceDestinationId- Returns:
- an Optional containing the name if present, empty otherwise
-
isStateId
public boolean isStateId()Returns true since this is a StateId.- Specified by:
isStateIdin interfaceDestinationId- Returns:
- always true
-
stateId
Creates a new StateId with the specified value and no name.- Parameters:
value- the state identifier string- Returns:
- a new StateId instance
- Throws:
IllegalArgumentException- if the value is invalid
-
stateId
Creates a new StateId with the specified value and name.- Parameters:
value- the state identifier stringname- the optional human-readable name- Returns:
- a new StateId instance
- Throws:
IllegalArgumentException- if the value is invalid
-
name
Creates a new StateId with the same value but a different name.- Parameters:
name- the new name for this state ID- Returns:
- a new StateId instance with the specified name
-
orNull
Creates a StateId from the given value and name, returning null if the value is null.- Parameters:
value- the state identifier stringname- the optional human-readable name- Returns:
- a new StateId instance or null if value is null
-
compareTo
Compares this StateId with another for ordering. Comparison is based on the string value.- Specified by:
compareToin interfaceComparable<StateId>- Parameters:
o- the StateId to compare with- Returns:
- a negative integer, zero, or a positive integer as this StateId is less than, equal to, or greater than the specified StateId
-
equals
Compares this StateId with another object for equality. Two StateId instances are equal if they have the same string value. -
hashCode
public int hashCode()Returns the hash code for this StateId based on its string value. -
toString
Returns a string representation of this StateId.
-